Use the Appstore user ID
The user ID is a unique identifier for every customer that uses IAP. Retrieve your customer’s user ID through thePurchasingService.getUserData() method. For details, see Get User Information.
If you have implemented your app in Unity, fetch the user ID by implementing IAmazonExtensions. For details, see Amazon Appstore and Amazon Underground Store Extended Functionality. Alternatively, use the getUserData() method of the Amazon IAP plugin. For details, see GetUserData.
To track your customer’s purchase history and trends, link the customer’s Appstore user ID to your identity management system. Introduce an identity system to your app by integrating with an identity platform, such as Login with Amazon or A3L Authentication. Alternatively, you can use other services (for example, Facebook’s login service), or create your own system.
IAP receipt validation
After a user completes a purchase, process the receipt in youronResume() call without requiring further user interaction. For details, see Implement getPurchaseUpdates method.
To validate the receipt, integrate with the Receipt Verification Service for Appstore SDK IAP. The RVS call requires the following parameters:
-
A receipt ID. This is the unique identifier of every purchase. Retrieve the
ReceiptIdobject fromonPurchaseResponse()callbacks as shown in the following example. -
A user ID. This is the unique identifier of the customer. Retrieve the user ID string from
onUserDataResponse()callbacks as shown in the following example.
Request and response examples
The following example shows a request that verifies a receipt on the RVS production server:Receipt verification
Your app may be vulnerable to refund fraud if the server-side receipt verification is not implemented properly. If you do not verify the cancel date, a customer could cancel a purchase and continue to receive services. With Receipt Verification Service (RVS), you can check thecancelDate field to verify the receipt. For all in-app purchases (consumables, entitlements, or subscriptions), the receipt is valid if the cancelDate field is null.
Here is an example of a canceled receipt:
Additional recommendations
- Monitor trends of the canceled receipts by creating a process to call the RVS within 72 hours for each active receipt.
- Keep the rate of the polling below 10 Transactions Per Second (TPS) to avoid request throttling.
- Continuous polling of RVS for canceled receipts is not recommended because canceled receipts cannot be revived.
- If your request for a
receiptIdgets throttled, then wait for some time before retrying the samereceiptIdand reduce your calling rate.

