Developer Console

RVS Examples for Appstore SDK IAP

RVS examples for the RVS sandbox environment and the Amazon RVS production server, along with the responses for each example. Note that these examples use working URLs, so if you paste the request into a browser, you should receive the same response as the example.

RVS Cloud Sandbox example

The following request verifies a receipt in the RVS Cloud Sandbox:

https://appstore-sdk.amazon.com/sandbox/version/1.0/verifyReceiptId/developer/developerSecret/user/l3HL7XppEMhrOGDnur9-ulvqomrSg6qyODKmah76lJU=/receiptId/q1YqVbJSyjH28DGPKChw9c0o8nd3ySststQtzSkrzM8tCk43K6z0d_HOTcwwN8vxCrVV0lEqBmpJzs_VS8xNrMrP0ysuTSo2BAqXKFkZ6SilACUNzQxMzAyNjYyNDQ3MgDKJSlZpiTnFqTpK6UpWJUWlQEYahFELAA

This call receives a JSON response from the RVS Cloud Sandbox server:

{
  "autoRenewing": false,
  "betaProduct": false,
  "cancelDate": null,
  "cancelReason": null,
  "deferredDate": null,
  "deferredSku": null,
  "freeTrialEndDate": 1606985788979,
  "gracePeriodEndDate": 1606985788979,
  "parentProductId": null,
  "productId": "com.amazon.subs1",
  "productType": "SUBSCRIPTION",
  "promotions": null,
  "purchaseDate": 1604613233106,
  "quantity": 1,
  "receiptId": "q1YqVbJSyjH28DGPKChw9c0o8nd3ySststQtzSkrzM8tCk43K6z0d_HOTcwwN8vxCrVV0lEqBmpJzs_VS8xNrMrP0ysuTSo2BAqXKFkZ6SilACUNzQxMzAyNjYyNDQ3MgDKJSlZpiTnFqTpK6UpWJUWlQEYahFELAA",
  "renewalDate": 1606985788979,
  "term": "1 Month",
  "termSku": "com.amazon.subs1_term",
  "testTransaction": true
}

Consumable example

The following request is to verify the purchase of a consumable receipt on the RVS production server:

https://appstore-sdk.amazon.com/version/1.0/verifyReceiptId/developer/2:smXBjZkWCxDMSBvQ8HBGsUS1PK3jvVc8tuTjLNfPHfYAga6WaDzXJPoWpfemXaHg:iEzHzPjJ-XwRdZ4b4e7Hxw==/user/LRyD0FfW_3zeOlfJyxpVll-Z1rKn6dSf9xD3mUMSFg0=/receiptId/wE1EG1gsEZI9q9UnI5YoZ2OxeoVKPdR5bvPMqyKQq5Y=:1:11

This call receives the following sample JSON response:

{
 "autoRenewing":false,
 "betaProduct":false,
 "cancelDate":null,
 "cancelReason":null,
 "freeTrialEndDate":null,
 "fulfillmentDate":null,
 "fulfillmentResult":null,
 "gracePeriodEndDate":null,
 "parentProductId":null,
 "productId":"com.amazon.iapsamplev2.gold_medal",
 "productType":"CONSUMABLE",
 "promotions":null,
 "purchaseDate":1399070221749,
 "purchaseMetadataMap":null,
 "quantity":1,
 "receiptId":"wE1EG1gsEZI9q9UnI5YoZ2OxeoVKPdR5bvPMqyKQq5Y=:1:11",
 "renewalDate":null,
 "term":null,
 "termSku":null,
 "testTransaction":true
}

The purchaseDate and cancelDate are represented as time in milliseconds. You can call java.util.Date(timeInMillis) to convert the values into a date object. A cancelDate of null indicates that the purchase has not been canceled. If the receipt is for a canceled purchase the cancelDate would reflect the date the purchase was canceled by Amazon customer support.

Subscription example

The following request is to verify the purchase of a subscription receipt on the RVS production server:

https://appstore-sdk.amazon.com/version/1.0/verifyReceiptId/developer/2:SPOkNr03vVx0_u04edvPTf5t6VC-HHS4535VkVviYJp7fCvSepKM5Ys-_ODYdtw8:Y-tOqaWFAXCHluaxssj9VQ==/user/7m7UQpSnce0DcAOgcCZFVW5-sNc2rVYE6aQCGc6URNU=/receiptId/JyGJ5iEtYgFu1ngnQovTqSIHQxR53GsMLqkR1tKLp5c=:3:11

This call receives the following sample JSON response:

{
 "autoRenewing":false,
 "betaProduct":true,
 "cancelDate":1400784371000,
 "cancelReason":1,
 "freeTrialEndDate":null,
 "fulfillmentDate":null,
 "fulfillmentResult":null,
 "gracePeriodEndDate":null,
 "parentProductId":null,
 "productId":"sub1",
 "productType":"SUBSCRIPTION",
 "promotions":null,
 "purchaseDate":1400784241000,
 "purchaseMetadataMap":null,
 "quantity":null,
 "receiptId":"JyGJ5iEtYgFu1ngnQovTqSIHQxR53GsMLqkR1tKLp5c=:3:11",
 "renewalDate":null,
 "term":"1 Week",
 "termSku":"sub1-weekly",
 "testTransaction":true
}

The purchaseDate and cancelDate are represented as time in milliseconds. You can call java.util.Date(timeInMillis) to convert the values into a date object. A cancelDate of null indicates that the subscription for this receipt is still active. If the receipt is for an expired subscription the cancelDate would reflect the date the subscription expired, or the date it was canceled by Amazon customer support. The cancelReason indicates why the subscription was canceled (possible values are null, 0, 1, or 2, where each integer represents a cancellation reason). A gracePeriodEndDate of null indicates that the subscription for this receipt is not in a grace period. If the receipt is for a subscription in grace period, the gracePeriodEndDate reflects the date the subscription grace period ends.

Promotional pricing example

The following is a response from the verifyReceiptId API when the subscription was purchased with promotional pricing:

{
 "autoRenewing": true,
 "betaProduct": false,
 "cancelDate": null,
 "cancelReason": null,
 "deferredDate": null,
 "deferredSku": null,
 "freeTrialEndDate": 1651730558000,
 "fulfillmentDate": null,
 "fulfillmentResult": null,
 "gracePeriodEndDate": 1606985788979,
 "parentProductId": null,
 "productId": "1yearOTCharge",
 "productType": "SUBSCRIPTION",
 "promotions": [
    {
      "promotionStatus": "Queued",
      "promotionType": "Introductory Price - All Customers"
    }
 ],
 "purchaseDate": 1651644158000,
 "receiptId": "IhE6m0uPLZ3dPz1WkGU5Ah6dmoDzJSLP3ed82jkxn2Y=:3:11",
 "renewalDate": 1651730558000,
 "term": "1 Week",
 "termSku": "1yearOnetimechargeterm",
 "testTransaction": false
}

Entitlement example

The following request is to verify the purchase of an entitlement receipt on the RVS production server:

https://appstore-sdk.amazon.com/version/1.0/verifyReceiptId/developer/2:smXBjZkWCxDMSBvQ8HBGsUS1PK3jvVc8tuTjLNfPHfYAga6WaDzXJPoWpfemXaHg:iEzHzPjJ-XwRdZ4b4e7Hxw==/user/LRyD0FfW_3zeOlfJyxpVll-Z1rKn6dSf9xD3mUMSFg0=/receiptId/mINy5VRd1FqjVOz-WBtTqw9FBGWhnuVx07kzTBMR600=:2:11

This call receives the following sample JSON response:

{
 "autoRenewing":false,
 "betaProduct":false,
 "cancelDate":null,
 "cancelReason":null,
 "freeTrialEndDate":null,
 "fulfillmentDate":null,
 "fulfillmentResult":null,
 "gracePeriodEndDate":null,
 "parentProductId":null,
 "productId":"com.amazon.iapsamplev2.gold_medal",
 "productType":"ENTITLED",
 "promotions":null,
 "purchaseDate":1399070221749,
 "purchaseMetadataMap":null,
 "quantity":1,
 "receiptId":"mINy5VRd1FqjVOz-WBtTqw9FBGWhnuVx07kzTBMR600=:2:11",
 "renewalDate":null,
 "term":null,
 "termSku":null,
 "testTransaction":true
}

The purchaseDate and cancelDate are represented as time in milliseconds. You can call java.util.Date(timeInMillis) to convert the values into a date object. A cancelDate of null indicates that the purchase has not been canceled. If the receipt is for a canceled purchase the cancelDate would reflect the date the purchase was canceled by Amazon customer support.


Last updated: Jun 12, 2024