Developer API

In-app Purchase Validation

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:

Name Expected Value
package_name Package name of the app in which product of the request purchase is defined.
product_id SKU of the product.
purchase_token Purchase 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:

Name Description
consumptionState The consumption state of requested purchase. This field is 0, if the purchase is consumed, and 1 otherwise.
purchaseState The purchase state of requested purchase. Normally this field is 0, but if the purchase is refunded it is 1.
kind Type of the returned resource. This will always be androidpublisher#inappPurchase
developerPayload The payload string that is sent to Bazaar by app when making the purchase.
purchaseTime Time 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 anerror_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.