question

onesrv avatar image
onesrv asked

Live Test in-app entitlement succesfully purchased not

I am currently testing in-app purchase of an entitlement in Live App Test. With Amazon app test everything works fine. In Live App Test i can succesfully purchase entitlement, but when i close and reopen app, it seems that entitlement was never purchased and i can perform another purchase wihthout any error. Any help would be appreciated . Thanks
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.

Nick Gardner avatar image
Nick Gardner answered
Hi, If you check onPurchaseUpdates() do you see the purchases that you previously did in the live app test? Further, if you use the app tester to test it locally, does the same behavior occur? Thanks, Nick
10 |5000

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

onesrv avatar image
onesrv answered
Hi, how can i check in onPurchaseUpdates() if the app was downloaded throug live app test? Do i have to insert debugging logic in the app and then upload to live test the apk ? Using the app test everything works fine. this is the sequence of listener's methods thah are called: onProductDataResponse onUserDataResponse onPurchaseUpdatesResponse However in onPurchaseUpdatesResponse() i have no information that tells me if inapp item was purchased. PurchaseUpdatesResponse object does not contain any receipts. And that's the reason because after the purchase has benn completed, in onPurchaseResponse() which has a receipt, i store locally in database that license was purchased. Is that the right implementation or am I missing something? Thanks, Gabriele
10 |5000

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

Nick Gardner avatar image
Nick Gardner answered
Apologies, I was actually thing of getPurchaseUpdates(), but it should do the same thing. Per the documentation: onPurchaseUpdatesResponse(PurchaseUpdatesResponse purchaseUpdatesResponse): Invoked after a call to getPurchaseUpdates(boolean reset). Retrieves the purchase history. Amazon recommends that you persist the returned PurchaseUpdatesResponse data and query the system only for updates. It is suggested that you persist it, but because these are entitlements, and should therefore transfer between devices, it should always have a record as long as the purchase is valid. Thanks, Nick
10 |5000

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

onesrv avatar image
onesrv answered
Sorry Nick but onPurchaseUpdatesResponse does not give me the purchase history. onPurchaseUpdatesResponse(final PurchaseUpdatesResponse response) Object response contains: response.getRequestStatus(): succesful response.getUserData(): amazon ures datail response.getRequestId(): request id response.getReceipts(): CONTAINS NOTHING I have no receipt, and without it how ca i tell if entitlment is already purchased?
10 |5000

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

onesrv avatar image
onesrv answered
With getPurchaseUpdates(true) i can access the history of purchase. I onPurchaseUpdatesResponse() i put the logic to store locally the activation flag. With the app test everything works like a charm. When i build apk, start a new Live app Test, download the app on my mobile phone, it seems like i never purchased the entitlement. I can purchase more and more, and the inapp lets me do this without any error.
10 |5000

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

Nick Gardner avatar image
Nick Gardner answered
The boolean flag in getPurchaseUpdates controls whether you will get the entire purchase history. If you do not set this flag to true, you will only get new purchases since your last call. Therefore, if you want to get the full history, you will neeed to set the flag to true. You can find all of this in our API reference: https://developer.amazon.com/public/apis/earn/in-app-purchasing/javadocs-v2/in-app-purchasing-2.0-api-reference -Nick
10 |5000

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