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://payments-api.now.gg/
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": "<purchase_token_here>", "productId": "<product_id_here>", // Deprecated "type": "<store>" // Deprecated
productId and type fields have been deprecated.The following sample code illustrates the associated request using the verifyPurchase API.
import requests
url = "https://payments-api.now.gg/v2/sellers/order/verifyPurchase"
headers = {
"Authorization": "<payment_api_key_here>",
"Content-Type": "application/x-www-form-urlencoded"
}
data = {
"purchaseToken": "<purchase_token_here>"
}
response = requests.post(url, headers=headers, data=data)
print("Response Status Code:", response.status_code)
print("Response Body:", response.text)
curl -X \ POST "https://payments-api.now.gg/v2/sellers/order/verifyPurchase" \ -H \ "Authorization: <payment_api_key_here>" \ -H \ "Content-Type: application/x-www-form-urlencoded" \ -d "purchaseToken=<purchase_token_here>"
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 are sample responses from the verifyPurchase API for now.gg, ONEStore and Xiaomi stores.
{
"success": true,
"code": 0,
"codeMsg": "success",
"data": {
"appId": "11001",
"consumptionState": 0,
"currency": "USD",
"developerPayload": "<developer_payload>",
"isTestOrder": false,
"kind": "nowgg#productPurchase",
"orderAmount": "25.15",
"orderId": "<orderId>",
"packageName": "<package_name>",
"payStatusTxt": "Unpaid",
"payTimeTxt": "2024 - 10 - 3006: 08: 01",
"productId": "11223343",
"purchaseState": 0,
"purchaseTime": "1630529397",
"purchaseTimeMillis": "1630529397125",
"purchaseToken": "241028222221SGP61717",
"regionCode": "US",
"sellerGoodsId": "11223343"
}
}
{
"success": true,
"code": 0,
"codeMsg": "success",
"data": {
"appId": "11001",
"consumptionState": 0,
"countryCode": null,
"currency": null,
"developerPayload": "<developer_payload>",
"environment": "release",
"isTestOrder": false,
"kind": null,
"orderAmount": null,
"orderId": "<orderId>",
"packageName": "<package_name>",
"payStatusTxt": "Paid",
"payTimeTxt": null,
"productId": "11223343",
"productName": "<product_name>",
"purchaseState": 1,
"purchaseTime": "1763642919000",
"purchaseTimeMillis": "1763642919000",
"purchaseToken": "241028222221SGP61717",
"regionCode": null,
"sellerGoodsId": "11223343"
}
}
{
"success": true,
"code": 0,
"codeMsg": "success",
"data": {
"appId": "10362",
"consumptionState": 0,
"countryCode": "FR",
"currency": null,
"developerPayload": null,
"environment": "release",
"isTestOrder": false,
"kind": null,
"orderAmount": null,
"orderId": "<orderId>",
"packageName": "<package_name>",
"payStatusTxt": null,
"payTimeTxt": null,
"productId": "11223343",
"productName": "<product_name>",
"purchaseState": 1,
"purchaseTime": "1763643382000",
"purchaseTimeMillis": "1763643382000",
"purchaseToken": "PFR251120205611111111395373223875",
"regionCode": "FR",
"sellerGoodsId": "11223343"
}
}
null if the information is not available or supported.| 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) |
| appId | string | Unique Identifier for your app. Same as Payment ID. |
| consumptionState | int | The consumption state of the in-app product. 0: Yet to be consumed, 1: Consumed |
| countryCode | string | The country code of the user at the time of purchase. This value may vary depending on the store and the user’s billing region. Some stores may return null. |
| currency | string | The currency of the purchase. Examples – USD, INR, etc. |
| developerPayload | string | A developer-specified string containing supplemental information about an order. |
| environment | string | Indicates the environment in which the purchase was processed. release: Production purchase sandbox: Test or development purchase (store-dependent) |
| isTestOrder | boolean | Returns true or false if the order is generated during testing. |
| kind | string | The kind of in-app product purchased with a hardcoded type nowgg#productPurchase. |
| orderAmount | string | The orderAmount of your purchase. |
| orderId | string | The order ID associated with every in-app purchase product. |
| packageName | string | The packageName associated with your app. |
| payStatusTxt | string | Payment status as Paid or Unpaid. |
| payTimeTxt | string | Payment date and time associated with a purchase. |
| productId | string | Unique identifier for the purchased product. |
| productName | string | Product name of the purchased product. |
| purchaseState | int | The purchase state of the order. 0: Unpaid, 1: Paid, 2: Failed |
| purchaseTime | string | The time the product was purchased, in seconds since the epoch. |
| purchaseTimeMillis (DEPRECATED) | string | The time the product was purchased, in milliseconds since the epoch. Deprecated — use purchaseTime instead. |
| purchaseToken | string | The purchaseToken associated with a purchase. |
| regionCode | string | ISO 3166-1 alpha-2 billing region code at the time the product was granted. |
| sellerGoodsId | string | Unique identifier for the purchased product, identical to productId. Provided for backward compatibility. |
| 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. |
| 5014 | MULTISTORE_UNKNOWN_ERROR | Indicates a generic error from the Multistore API. |
| 5015 | MULTISTORE_AUTH_ERROR | Indicates an error while generating auth/credentials for Multistore API. |
Payments Module
Payments Module
Document Rev. 1.0