question

Vincent Ma avatar image
Vincent Ma asked

How to use RVSSandbox.war?

Hi there, I deployed the RVSSandbox.war into my tomcat web container. Now I use the sample purchase token from the page "Validate Transactions Outside Your App" to validate the receipt through sandbox. - https://developer.amazon.com/public/solutions/platforms/webapps/docs/rvs.html - 2:FbrWSsmkOBVNTTBbf6BtIr5tmbKD4r92laKjtHJp9z9tQyIDOP-vuEsdl1Jy1g0xxsQIa8JP3uIqNfm18GSRneOamsrYWGlpKFTrKb0DK3rlYlXhY4EH0ufJYuWpoOicNXCm6KKJ9seKcpwQ_I-a98pjCuHnlZk4pXgl3g_V3gJZGpWBtumd3kOVXYfcMjf268BaMjPS7plTZ_MPvzLrnjk==:qsy0n5EtZ344-LlDox4pPP== Now I got 498 HTTP response and the content is - Response: {"message":"Failed to parse iap token","status":false} - Request: http://localhost:8080/RVSSandbox/version/2.0/verify/developer/2:vMNY3fU9xI6IdQkPlr8CUI3mfqotyo21vPPTTtkkx2mw6imQ0Dp1hp_Z9zAVlOm3:RPi0W-BmE_HwCs04VcSNVA==/user/o2PK3XppEMmkOIU2ur6-wlpemmrSp4qyOOKmmk76pbU=/purchaseToken/2:FbrWSsmkOBVNTTBbf6BtIr5tmbKD4r92laKjtHJp9z9tQyIDOP-vuEsdl1Jy1g0xxsQIa8JP3uIqNfm18GSRneOamsrYWGlpKFTrKb0DK3rlYlXhY4EH0ufJYuWpoOicNXCm6KKJ9seKcpwQ_I-a98pjCuHnlZk4pXgl3g_V3gJZGpWBtumd3kOVXYfcMjf268BaMjPS7plTZ_MPvzLrnjk==:qsy0n5EtZ344-LlDox4pPP== I am sure I called the right API format. Now if you use my fake generated purchase token, it works. - Faked purchase token before Base64: {"sku": "com.vincent.testsku.1","startDate": "131731757992","stopDate": null,"type": "ENTITLED"} - Faked purchase token after Base64: eyJza3UiOiAiY29tLnZpbmNlbnQudGVzdHNrdS4xIiwic3RhcnREYXRlIjogIjEzMTczMTc1Nzk5MiIsInN0b3BEYXRlIjogbnVsbCwidHlwZSI6ICJFTlRJVExFRCJ9 - Request: http://localhost:8080/RVSSandbox/version/2.0/verify/developer/2:vMNY3fU9xI6IdQkPlr8CUI3mfqotyo21vPPTTtkkx2mw6imQ0Dp1hp_Z9zAVlOm3:RPi0W-BmE_HwCs04VcSNVA==/user/o2PK3XppEMmkOIU2ur6-wlpemmrSp4qyOOKmmk76pbU=/purchaseToken/eyJza3UiOiAiY29tLnZpbmNlbnQudGVzdHNrdS4xIiwic3RhcnREYXRlIjogIjEzMTczMTc1Nzk5MiIsInN0b3BEYXRlIjogbnVsbCwidHlwZSI6ICJFTlRJVExFRCJ9 - Response: {"endDate":null,"purchaseToken":"eyJza3UiOiAiY29tLnZpbmNlbnQudGVzdHNrdS4xIiwic3RhcnREYXRlIjogIjEzMTczMTc1Nzk5MiIsInN0b3BEYXRlIjogbnVsbCwidHlwZSI6ICJFTlRJVExFRCJ9","sku":"com.vincent.testsku.1","startDate":131731757992,"itemType":"ENTITLED"} Based on this document, the purchase token would look like: 2:FlrXSsmgOBKXoBbf6BtIrBtmbZLNr92LrRNGQ==:qsy5n5MMZM4u-LlDrqGp5Q== - https://developer.amazon.com/appsandservices/community/post/Tx3MWHLW9Q7FXHK/Introducing-Receipt-Verification-Service-RVS The document makes me confuse, and because Amazon doesn't provide its own test server, I want to know, which purchase token format is correct? -=Vincent>.
iap
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Vincent, The value of purchaseToken that is used in the document to demonstrate the service is generated from live IAP system and that value would be properly processed by live RVS server, i.e https://appstore-sdk.amazon.com/version/2.0 Now, while integrating IAP in the app, i.e before the app is submitted with IAP integration, you are supposed to test IAPs with mock data in json file and SDK tester app (sand box testing). After you purchase an item in Sandbox, SDK tester would provide you a token what could be processed by RVSSandbox.war (RVS in sandbox). e.g, I got below pt from a consumable purchase in one of my test app in sandbox String encodedToken = "eyJ0eXBlIjoiTk9OQ09OU1VNQUJMRSIsInNrdSI6ImNvbS5hbWF6b24uYnV0dG9uY2xpY2tlci5ibHVlX2J1dHRvbiJ9"; This gave me below response from sandbox RVS running in tomcat in localhost {type=ENTITLED, sku=com.amazon.buttonclicker.blue_button, startDate=null, stopDate=null, purchaseToken=eyJ0eXBlIjoiTk9OQ09OU1VNQUJMRSIsInNrdSI6ImNvbS5hbWF6b24uYnV0dG9uY2xpY2tlci5ibHVlX2J1dHRvbiJ9} So, in the test please do not use the token values given in the documentation. When your app will go live with IAP integration, the purchase token you are going to receive in your app client, that would of course work when you will send those to live RVS server from your app back end and those PT will be in the format that is used in the documentation your pointed. Does it make sense?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Vincent Ma avatar image
Vincent Ma answered
Hi Sujoy, I know we should not rely on the purchase token format of the Tester, or to guess the pattern for the purchase token. Now the problem would be: there is a bug for Apps - SDK (Web HTML5)... If you buy 10 clicks in ButtonClicker HTML page, put a breakpoint inside 'function onPurchaseResponse(e)', then take a look at the purchaseToken from ''e" variable, it is UTC milliseconds... And you use this token for RVSSandbox, the Sandbox always returns "failed to parse iap token". {"jsReqId":"76e722b2-eac0-4813-9324-8d52c0adefa5","requestId":"IAP.purchaseItemTue Jul 01 2014 12:04:49 GMT-0400 (EDT)","userId":"userId","purchaseRequestStatus":"SUCCESSFUL","receipt":{"itemType":"CONSUMABLE","purchaseToken":1404230689674,"sku":"sample.clicks","subscriptionPeriod":null}}
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Sorry for the late response. I have forwarded this to the concerned team. I would suggest you not to be blocked by this issue since correct Purchase Token will be sent in the live environment. I will get back once I hear back from our team. Thanks.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.