question

Torsten avatar image
Torsten asked

Guarantee for purchase Success event?

Hi, I am almost done implementing the IAP using Adobe Air. I just wonder whats the AmazonPurchaseEvent.PURCHASES_UPDATED good for? It is not documented for Adobe Air. I read somewhere for the Java lib, that the dev should call some refresh method on app startup, but this does not seem to exist for Adobe Air. So I am in general wondering, should I listen / handle this event at all? Is there a guarantee, that a success event for a purchase will always be called at some point, no matter if the application crashes or closes at any time during the purchase? If so, I could ignore the PURCHASES_UPDATED on only listen to success events and implement my verification queue there. 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.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Torsten, Thank you for showing interest on Amazon IAP. You can find Adobe Air plugin class reference/documentation in InAppPurchasing\plugins\adobe\docs\as3doc in Apps-SDK.zip. The event PURCHASES_UPDATED is dispatched when the status of purchased Items has been updated for the user. This event may be dispatched any time after the SDK is initialized. If any SKUs have been revoked since the last time the extension was initialized, they will be contained in the revokedSkus property. If there are any receipts available for currently updated purchases, they will be contained in the receipts property. So you need to handle this event along with other events to make sure your view of ownership is consistent across devices for an user as there is no guarantee of PURCHASE_SUCCEEDED or PURCHASE_FAILED events dispatch in case of app crashes or closes during purchase. Hope this helps.
10 |5000

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

Torsten avatar image
Torsten answered
Thanks for your reply. But as I understand, the purchaseToken differs between a SUCCESS and an UPDATE event for any given transaction. How can I distinguish between processed an unprocessed purchases of consumable items then? Lets say: User buys a consumable, I receive update event and process it on my server. Next time the user starts the app, I receive an UPDATE event with the same transaction but with a different purchaseToken. There is no way for me to know that this transaction has already been processed and should not be processed again? 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.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Torsten, Thank you for the reply. Actually, app would not receive said event for Consumable items. This event would be dispatched only for Entitlements and Subscriptions. You can refer these links for more information. https://developer.amazon.com/sdk/in-app-purchasing/documentation/adobe-api.html#Section1 https://developer.amazon.com/sdk/in-app-purchasing/documentation/consumable.html#Overview You can identify the item from the sku name (sku name would be included in revokedSkus or receipts Vector what are the member of AmazonPurchaseEvent Object passed with AmazonPurchaseEvent.PURCHASES_UPDATED event dispatch) for non-consumable items and check in you app whether the item has been credited to the user or not. As non-consumable items could be bought only once for an user, you could certainly manage it in your own with the unique sku name. Hope this helps.
10 |5000

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

Torsten avatar image
Torsten answered
Thanks, this clarifies the situation a bit. But then as I understand there can be cases in which the app crashes and the user never receives the purchased consumable. I will put all responsibility to amazon in these cases ;) Thanks for your help
10 |5000

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