This section contains the API reference for Verify Purchase API and the sample request code segments.
The verifyPurchase API is used to verify the in-app product purchase before assigning the IAP product to the user.
https://cloud-api.bluestacks.cn/
v2/seller/order/verifyPurchase
POST
'Authorization': '<payment_api_key_here>', 'Content-Type': 'application/x-www-form-urlencoded'
The following params should be included within the request body with verifyPurchase
API:
purchaseToken=<nowgg_purchase_token>
The following sample code illustrates the associated request using the verifyPurchase
API.
import requests url = "https://cloud-api.bluestacks.cn/v2/seller/order/verifyPurchase" payload = 'purchaseToken=<nowgg_purchase_token>' headers = { 'Authorization': '<payment_api_key_here>', 'Content-Type': 'application/x-www-form-urlencoded' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text)
curl --location 'https://cloud-api.bluestacks.cn/v2/seller/order/verifyPurchase' \ --header 'Authorization: <payment_api_key_here>' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'purchaseToken=<nowgg_purchase_token>'
Payments API Key
can be found within the credentials section of nowStudio. More information.purchaseToken
is returned after a successful purchase. You can refer to the following reference documents for more information:The following is a sample response from the verifyPurchase
API.
{ "success": true, "code": 0, "codeMsg": "success", "data": { "purchaseTimeMillis": "1630529397125", // This field has been deprecated, use purchaseTime instead. "purchaseTime": "1630529397125", "purchaseState": 0, "consumptionState": 0, "developerPayload": "<developer_payload>", "orderId": "<orderId_here>", "kind": "nowgg#productPurchase", "regionCode": "US", "currency": "USD", "packageName": "<package_name>", "payStatusTxt": "Paid", "orderAmount": "25.15", "isTestOrder": false, "payTimeTxt": "2024 - 10 - 3006: 08: 01", "sellerGoodsId": "11223343" } }
Params | Type | Description |
---|---|---|
success | boolean | Returns success as true or false. |
code | int | Returns 0 for success and non-zero for failure. |
codeMsg | string | Returns msg related to error code. (Provided here) |
purchaseTimeMillis (DEPRECATED) | string | The time the product was purchased, in milliseconds since the epoch. This field has been deprecated, use purchaseTime instead. |
purchaseTime | string | The time the product was purchased, in seconds since the epoch. |
purchaseState | int | The purchase state of the order. Possible values are: 0: Unpaid, 1: Paid, 2: Failed |
consumptionState | int | The consumption state of the in-app product. Possible values are: 0: Yet to be consumed, 1: Consumed |
developerPayload | string | A developer-specified string containing supplemental information about an order. |
orderId | string | The order ID (Unique transaction identifier) associated with every in-app purchase product. |
kind | string | The kind of in-app product purchased with a hardcoded type nowgg#productPurchase . |
regionCode | string | ISO 3166-1 alpha-2 billing region code of the user at the time the product was granted. |
currency | string | The currency of the purchase. Examples – USD, INR, etc. |
packageName | string | The packageName associated with your app. |
payStatusTxt | string | Payment status as Paid or Unpaid. |
orderAmount | string | The orderAmount of your purchase. |
isTestOrder | boolean | Returns results as true or false if the order is generated during testing. |
payTimeTxt | string | Payment date and time associated with a purchase. |
sellerGoodsId | string | The product ID is associated with the purchased product. |
Error Code | Message | Description |
---|---|---|
3900 | INVALID_AUTHORIZATION_KEY | The API Key provided for authorization is invalid. |
3901 | INVALID_PURCHASE_TOKEN | The provided purchase token is invalid. |
Payments Module
Payments Module
Document Rev. 1.0