Hi, in other implementations for In-App Purchases (GooglePlay, iTunes) there is something like completeTransaction(transactionId), which will tell the system, that a transaction has successfully completed. My application is sending purchases to the game server, which will then verify the transaction and issue the product. If the gameserver is not reachable or has a DB failure though, the client will be charged without ever receiving the item. In this case, I should not call completeTransaction() so that the client will try again to reach the game server on the next start up. It seems, that this is not supported with Amazon In-App Purchase? (Note: I am using the Adobe AS3 ANE) How would I handle a failure of my gameserver? Thanks
Hi, Thanks for posting. Amazon IAP does not provide unique identifier for every transaction. So I would suggest you to generate an unique id on your own in the back end for every purchase attempt happening in your client. In the table of your database, you can have fields for unique transaction id (int,unique and autoincreament)and the status (enum value could be like NOT_PURCHASED - default value, PURCHASED) of current attempt. you should insert into that table while user is going to purchase any item in the app before triggering the PurchasingManager.initiatePurchaseRequest(). Send the transaction id back to client in the response of the same request. You need to also persist the id in the client (sql lite is recommended) and maintain the status of the transaction there (like NOT_PURCHASED - default value, PURCHASED_BUT_NOT_NOTIFIED_TO_GAME_SERVER, PURCHASED_AND_NOTIFIED_TO_GAME_SERVER). If user purchases the item, change the status of the current transaction attempt to "PURCHASED_BUT_NOT_NOTIFIED_TO_GAME_SERVER". Then send request to server to validate the token and change status of transaction attempt in the db table to "PURCHASED". After receiving the response of the this request in the client you should finally change the status of transaction in client to "PURCHASED_AND_NOTIFIED_TO_GAME_SERVER". This way you are maintaining the transaction log in client and server both so that you can sync later on. In start of your main activity you can check the local transaction persistence and if any purchase attempt stays in PURCHASED_BUT_NOT_NOTIFIED_TO_GAME_SERVER, you could resend the validation request that time.
Hi, thanks for your response. Of course, implementing this is not too hard, I was just expecting something built in. I would guess you take a huge risk for your customers this way, because many developers might not think of this. Thanks