Skip to main content
Version: 5.7.0

VerifyItunesReceipt

Method verifies an iTunes receipt. On success, the player will be awarded the associated currencies.

Apple receipts will often contain old transactions. The key values of the return to evaluate include:

  • processedCount - number of transactions successfully processed. To be processed, a transaction receipt must be valid, the product must be found, and the transaction must not have been processed before.
  • unprocessedCount - the number of transactions that were rejected. See the transactionStatus code associated with the transaction for details.
ServiceOperation
productOP_CASH_IN_RECEIPT

Method Parameters

ParameterDescription
base64EncReceiptDataThe iTunes receipt payload string

Usage

http://localhost:3000
string base64EncReceiptData = "Sample iTunes Receipt";
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};

_bc.ProductService.VerifyItunesReceipt(base64EncReceiptData, successCallback, failureCallback);
JSON Response
{
"status": 200,
"data": {
"status": 0,
"playerCurrency": {
"updatedAt": 1473060489422,
"currencyMap": {
"Coin": {
"purchased": 0,
"balance": 1000,
"consumed": 0,
"awarded": 1000
}
},
"playerId": "c7acba9c-91f7-473b-b841-33ed8c170b7c",
"createdAt": 1472813596516
},
"appleReceipt": "xxx",
"transactionSummary": {
"processedCount": 1,
"unprocessedCount": 0,
"transactionDetails": [
{
"original_transaction_id": "1000000234728140",
"product_id": "Coins100",
"purchase_date_ms": 1473325498000,
"quantity": 1,
"purchase_date": "2016-09-08 09:04:58 Etc/GMT",
"transactionStatus": 0,
"transaction_id": "1000000234728140"
}
]
},
"server_time": 1473325588695
}
}
Common Error Code

Status Codes

CodeNameDescription
0STATUS_OKSuccessfully verified, new currencies awarded.
100STATUS_FAILED_ALREADY_PROCESSEDAlready verified and awarded currencies.
101STATUS_FAILED_NO_ITUNES_PRODUCT_IDThe product id is not configured in iTunes Connect for this app. This is likely a fraud attempt.
102STATUS_FAILED_PRODUCT_NOT_FOUNDiTunes product id exists, but cannot locate the product in brainCloud Product Inventory. *This is likely a configuration error in the brainCloud product - double-check the iTunes price settings for the product.**