Skip to main content

Validate a Myket Purchase

To confirm purchase status and reduce fraud, verify purchases with Myket from your app's server. This API is for server-to-server calls only; never put the access token in a client app.

Security

X-Access-Token is confidential. Store it only on a secure server. Never include it in client code, a released app, or a public repository.

Request​

curl --request POST \
'https://developer.myket.ir/api/partners/applications/{PACKAGE_NAME}/purchases/products/{SKU_ID}/verify' \
--header 'X-Access-Token: {ACCESS_TOKEN}' \
--header 'Content-Type: application/json' \
--data '{
"tokenId": "{TOKEN_ID}"
}'

Replace the path and request-body values with the purchase information:

ParameterDescription
PACKAGE_NAMEApp package name, for example, org.example.app
SKU_IDIn-app product ID, for example, GEM2
ACCESS_TOKENApp access token obtained from the Developer Panel
TOKEN_IDPurchase token for the transaction

Successful purchase response​

{
"kind": "androidpublisher#productPurchase",
"purchaseTime": 1492839267000,
"developerPayload": "",
"purchaseState": 0,
"consumptionState": 1
}
  • purchaseState: Purchase status; 0 means successful and 1 means unsuccessful.
  • purchaseTime: Transaction time as a Unix timestamp in milliseconds.
  • kind: Purchase type.
  • developerPayload: Value supplied by the app when the purchase was started.
  • consumptionState: Consumption status; 0 means not consumed and 1 means consumed.

Error response​

For example, a server-side error may return a response similar to:

{
"code": 500,
"messageCode": "InternalError",
"translatedMessage": "An error occurred."
}