question

somewhatdog avatar image
somewhatdog asked

PurchasingManager (Sandbox) not responding correctly

I've run into this in my own app but I can confirm it's also a problem in the "Buttonclicker" sample app as-well - all using the latest SDK, downloaded yesterday. I've setup the SDK Tester with a JSON file supporting my SKUs and purchasing works AOK both in ButtonClicker and in my own App. Problem is, when I change the config of the SDK Tester Purchase API to anything other than 'Default' - e.g. ""Already Purchased", "Invalid SKU" or "Failed" - I never get a response from the PurchasingManager This cannot be how it's meant to work!? PurchaseResponse appears to support a range of statuses including ALREADY_ENTITLED, FAILED and INVALID_SKU - but NOTHING is being returned by the PurchasingManager - the Observer is never called... This renders me unable to test In-App Purchases - and as it effects your 'sample' it's clearly something awry in the API itself?
iap
10 |5000 characters needed characters left characters exceeded

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

somewhatdog avatar image
somewhatdog answered
I should add that if I 'buy' an item and then attempt to buy it again, that part of it works AOK (returning ALREADY_PURCHASED) It's just changing the settings in the SDK Tester which results in no responses whatsoever...
10 |5000 characters needed characters left characters exceeded

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

Samuel@Amazon avatar image
Samuel@Amazon answered
Hi, The purchase API has four response states(Success, Failed, Already_Entitled, Invalid_Sku) and each should be tested. You cannot add any new response state to the IAP. 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). Developers do not need to provide purchase dialogs, transaction timeout logic, or "Thank You" dialogs these are all provided by the Amazon Client. The client presents the user interface for all aspects of the purchase workflow. It provides the logic to display the purchasable item, perform the 1-Click purchase itself, and handle any preconditions or error scenarios that arise. In the event a purchase is unsuccessful, the 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. You do not need to provide a confirmation or other interstitial dialog to the customer regarding the purchase flow. As a developer, you do not need to directly interface with the client; the PurchasingManager will take care of that for you. For more info about this, please refer to IAP developer guide( https://developer.amazon.com/sdk/in-app-purchasing/documentation/developer-guide.html). Thank you.
10 |5000 characters needed characters left characters exceeded

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

somewhatdog avatar image
somewhatdog answered
You seem to have completely misunderstood my question - and I thought I'd made it fairly clear but I'll try again. The SDK Tester offers a way of changing how it responds (Interactive Mode) so that we can test for states other than 'success'. If you change the setting of "Purchase API" to anything other than 'Default', however, calls to PurchasingManager.initiatePurchaseRequest(SKU) result in no response being passed to the PurchasingObserver - nothing happens whatsoever - onPurchaseResponse is never called... This happens with the supplied example App (ButtonClicker) as well as my own App. You can test a purchase - that a repeated purchase fails and that a cancelled purchase returns 'CANCELLED' without using Interactive Mode of course - but there's no way to simulate something like a card verification failure without Interactive Mode and so we cannot check that in any way...
10 |5000 characters needed characters left characters exceeded

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

Sachin@Amazon avatar image
Sachin@Amazon answered
Hi, Please find the complete information on how the SDK tester works at the below link. This will also give you idea on what all is currently supported by SDK tester. https://developer.amazon.com/sdk/in-app-purchasing/documentation/testing-iap.html#Test%20Cases
10 |5000 characters needed characters left characters exceeded

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

somewhatdog avatar image
somewhatdog answered
According to that document, changing the response status should work - and as I've said twice now, it doesn't. As I also said, it doesn't really matter for simple one-off purchase testing - but it would be trickier testing subscriptions or consumable purchases perhaps.
10 |5000 characters needed characters left characters exceeded

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

Dixith@Amazon avatar image
Dixith@Amazon answered
Hi , As per the steps in IAP documentation, we have tested the Button Clicker app in KF HD emulator and changed the settings of PurchaseAPI to other than default ,observed that onpurchaseresponse( ) called every time as per the purchaseAPI settings. Below successful and failed response messages in logcat for button clicker activity. successful:- onPurchaseUpdatesRecived recieved: Response -(com.amazon.inapp.purchasing.PurchaseUpdatesResponse@415xxd60, requestId: "xxxxxxxxxxxbd62b4525", purchaseUpdatesRequestStatus: "SUCCESSFUL", userId: "deekshit", receipts: [], revokedSkus: [], offset: "1353499995966", isMore: "false") In App Purchasing SDK - Sandbox Mode: Running Runnable for purchaseUpdatesResponse with requestId: 2e2afa50-xxxx-4cf0-bxxf-05xxx957xxxf failed: onPurchaseResponse recieved Failed purchase for requesthasPurpleButton If you still face any issues, please raise a contact-us( https://developer.amazon.com/help/contactus.html) with your logcat information. This would help us to assist you further.
10 |5000 characters needed characters left characters exceeded

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