User kills the app while the "Thank You" popup is displayed during IAP
Hi The issue i am facing is that if the user purchases a consumable and then kills the app while the "Thank You" popup is displayed, the app never gets a feedback about the purchase but the amount would have been deducted. Is there any way to handle this ?
If the Amazon Appstore client couldn’t deliver the receipt of the purchased consumable item to your app, it would try again at a later time. After the grace period, if your app call initiatePurchaseUpdatesRequest(), pending receipt will be delivered through onPurchaseUpdatesResponse(). If the user make another purchase, pending receipt will be delivered through onPurchaseResponse(). Thanks.
Thanks for the reply Sujoy :) But i am using the Adobe plugin to handle IAP and it doesn't have initiatePurchaseUpdatesRequest(). There does exist a restoreTransactions() function but it states that it will return the status of "non-consumables". Is there a way using the Adobe plugin, which i missed ? Also, as you said the pending receipt will be delivered if the user makes another purchase i am assuming it applies to the same item, right ? Will the receipt of other pending purchases will also be returned if i try to buy a different item ? PS: all of this is in the context of consumables Thanks in advance. Message was edited by: Shanmi
Hey Shanmi, Thank you for writing back. You are true that we do not have any direct API in Air which is equivalent to initiatePurchaseUpdatesRequest() method of our Android SDK. Insetad, the Adobe IAP plugin is designed such a way that at any time after you've called AmazonPurchase.create(), you may receive an AmazonPurchaseEvent.PURCHASES_UPDATED event and with this event if you have registered any method to be listened by this event, that would be called. In short, you do not have to make any explicit call for particularly for initiating PurchaseUpdatesRequest which is internally always called from inside AmazonPurchase.create(). Only thing you have to make sure that you are calling AmazonPurchase.create() in every app resume. If one app is killed when “Thank You” popup is displayed after a consumable purchase, the IAP SDK would be responsible to deliver the receipt to the app through AmazonPurchaseEvent.PURCHASES_UPDATED event. However, as you said, AmazonPurchaseEvent.PURCHASES_UPDATED does not carry any receipt for “consumable” type items, [b]but if any receipt is pending in the queue to be delivered in IAP SDK for a consumable item (due to some unwanted reason), that would be delivered through AmazonPurchaseEvent.PURCHASES_UPDATED event as a special case[/b]. [b]This exception is made due to give the developer a chance to fail over the successful but not processed purchase by user.[/b] Please note, the system might take some time to deliver this pending receipt. So as a result the app might not receive the receipt for next launch that happens immediately after the exit. But we do make sure the receipt is delivered to app within a reasonable time through AmazonPurchaseEvent.PURCHASES_UPDATED event after the exit happens. So the user should be able to receive the item within couple of revisits to your app. Also, if the user makes another purchase in the mean time of first purchase (and terminate the app) and the receipt is not delivered through AmazonPurchaseEvent.PURCHASES_UPDATED, the user would receive the first receipt (which is pending) as AmazonPurchaseEvent.PURCHASE_SUCCEEDED event As a developer you need to make sure that AmazonPurchase.create() is called when user resumes to app every time in your app to handle any fail over case for consumable items. Does it make sense?
1 question btw, If i don't handle the purchase-update event on app resume but the user then tries to purchase the same item, the pending receipt for the item will be delivered ? and Will the user be charged any money for the purchase ? i mean that will he be charged initially and refunded later or will not be charged at all ? Thanks in advance :)
Hi Shanmi, If the user tries to buy the same item, he would be allowed to buy it and he would be charged again. But he should receive 2 receipts together through PURCHASE_SUCCEEDED event, one is the pending receipt and the second one is for current purchase. And since the type of the item is consumable, user would be credited the item twice.
Thanks for the reply Sujoy So, that means in my purchase-success-event i will get all the pending receipts in event.receipts. e.g. i had 2 pending receipts, 1 for item_1 and and ano 1 for item_2 So, if i buy item_1 again will i get 2 receipts for item_1 only or all the receipts i.e. 2 for item_1 and 1 for item_2 (3 in total) And will i get the pending receipts only once for the purchase or is there a time-limit or a confirmation call or something like consume ? Also, Since the consumables are supposed to be tied to the device and not the user, will i get any pending receipts from other users who had used the device? e.g. if a user kindle_1 has 2 pending purchases and i am now logged in with kindle_2 (1 pending purchase) for the same item, will 1 get 1 pending receipt and 1 current receipt only for this user or 3 pending receipts and 1 current receipt from all users on the device Sorry for the questions but its difficult to find any direct info on it. You have been a great help all this time :) Thanks in advance.
1. Yes, if you have 2 pending receipts, those are supposed to be passed through purchase-success-event [b]only once[/b]. User would receive 3 receipts in total. 2. The consumables are tied with the device but they are associated with the user. So if you change the account in the device, pending receipts will be lost. The new user will never be delivered the pending receipts for same app and for same different item purchase. Happy to help your detailed question. Thanks.