question

highbrow-inc avatar image
highbrow-inc asked

Call back after clicking on 'Purchase' button

Here is my log msgs: 04-21 18:16:33.741: I/AmazonSDKTester(1486): Initializing Purchase Flow. on line 16 of file:///android_asset/web/js/purchase.js 04-21 18:16:33.741: I/ADM(28180): [ADM][D2SM][Flush][42e08e28-5177-4f5e-9e87-d92863f1b4c9][Auth]Received response code 200 OK. Total time = 1355 ms. Handshake = 767 ms. Upload = n/a ms (2538 bytes). Latency = 529 ms. Download = 5 ms (160 bytes). 04-21 18:16:33.796: I/ADM(28180): [ADM][D2SM][Flush]Schedule Flush: Nothing to flush, cancelling alarm 04-21 18:16:34.804: I/ADM(28180): [ADM][D2SM]Queues are not busy, stopping: 1 04-21 18:16:35.257: I/AmazonSDKTester(1486): Purchasing consumable (gem10_3) 04-21 18:16:35.272: I/AmazonSDKTester(1486): Completing purchase. on line 35 of file:///android_asset/web/js/purchase.js I'm just wondering whether there is a call back when the purchase button is clicked. Is this because I'm in the sandbox mode? if so how do I change to live mode? although my app is not live yet.... Thank you
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 highbrow, Thank you for reaching us. You are not supposed to receive any callback instantly when the purchase button is clicked in the IAP purhcase window. You might observe it that the purchase action is a blocking call and we the UI and show loading bar while the button is clicked. Now when the purchase process is completed in the Amazon back end server, you should certainly get a callback in onPurchaseResponse in the derived class implementation of BasePurchasingObserver. Things should work in the same way in sandbox and live mode. If you are not receiving any callback please check whether you have declared Purchase Observer statically in Manifest or not. My recommendation is for you is to go through the sample apps provided with IAP SDK. Please refer the dcumentaions linked in the below page for more information. Thanks. https://developer.amazon.com/public/apis/earn/in-app-purchasing
10 |5000

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

highbrow-inc avatar image
highbrow-inc answered
Hi, Thank you for the quick reply. It seems everything works fine since I just copy pasted the sample app code ^^; But it seems that onPurchaseResponse is called when 'x' button is pressed so what I'm wondering is that what happens if user click on purchase button and decides to just force close the game. For example, battery runs out just after clicking on purchase button and user didn't have chance to click the close button. In this case does user get charged?? or user will only get charged after 'x' button is pressed?
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, Thank you for writing back. If transaction is successful, i.e the user clicks on Buy or Subscribe and Amazon gets the money, only then app will receive the Purchase Receipt through onPurchaseResponse(). So while X is pressed in Purchase Modal Popup, you will not receive any receipt that time. Also, If something goes wrong during the purchase and app is closed by some means, app will still be notified about the pending receipts through next onPurchaseUpdatesResponse() for Entitlement and Subscription type items. The Amazon Client will take care of the purchase workflow, starting when the customer decides to purchase an item and ending when the store provides the application a receipt for the purchase (or other status in the case of a failed purchase). In the event a purchase is unsuccessful, the Amazon Client will present messaging to the customer; your app should not message the customer. For example, if the customer does not have a valid credit card on file, the client redirects the customer to a page where they can update their payment information.
10 |5000

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