Print

This function returns status of purchase and consume of an in-app purchase.

https://pardakht.cafebazaar.ir/devapi/v2/api/validate/<package_name>/inapp/<product_id>/purchases/<purchase_token>/

You should fill the values in the angle brackets according to your request:

NameExpected Value
package_namePackage name of the app in which product of the request purchase is defined.
product_idSKU of the product.
purchase_tokenPurchase token returned by Bazaar to app.

Note that you need a valid access_token to use this method.

The result will look similar to:

{
   "consumptionState": 1,
   "purchaseState": 0,
   "kind": "androidpublisher#inappPurchase",
   "developerPayload": "something",
   "purchaseTime": 1414181378566
}

The description of each field is as followed:

NameDescription
consumptionStateThe consumption state of requested purchase. This field is 0, if the purchase is consumed, and 1 otherwise.
purchaseStateThe purchase state of requested purchase. Normally this field is 0, but if the purchase is refunded it is 1.
kindType of the returned resource. This will always be androidpublisher#inappPurchase
developerPayloadThe payload string that is sent to Bazaar by app when making the purchase.
purchaseTimeTime of the purchase as milliseconds from EPOCh (1970/1/1).

In case of an error, you'll recieve a response with 40X status code, with a body of JSON object containing an error field which specifies the error and an error_description field explaining the cause of error. For example, if the requested purchase is not found, the response would have a 404 status code and this content:

{
   "error": "not_found",
   "error_description": "The requested purchase is not found!",
}

Notice: You can be sure that requested purchase is not done, only when error is equal to not_found. This might occur when the user of your app is trying to fake purchases.

Was this content helpful?
Write your comment here...

If you have any comment on this content or any idea to make it better, use this form to send us your comment.

Publish Date: 1400-04-11 12:47

Latest Update: 1400-04-14 17:01