This document focuses on the consumePurchase
API used for server-side purchase consumption.
After you have verified the purchase, you should mark it as consumed.
Purchase consumption involves:
https://cloud-api.bluestacks.cn/
v2/order/consumePurchase
POST
'Authorization': '<payment_api_key_here>', 'Content-Type': 'application/x-www-form-urlencoded'
The following params should be included within the request body with consumePurchase
API:
purchaseToken=<nowgg_purchase_token>
The following sample code illustrates the associated request using the consumePurchase
API.
import requests url = "https://cloud-api.bluestacks.cn/v2/order/consumePurchase" 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)
Payments API Key
can be found within the credentials section of nowStudio. More information.The following is a sample response from the consumePurchase
API.
{ "success": true, "code": 0, "codeMsg": "success", "data": {} }
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. |
data | object | Data returned as a response. |
Error Code | Message | Description |
---|---|---|
3800 | ERROR_CONSUMING_PRODUCT | There was an error consuming the product. |
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