- Home /
Amazon IAP works in sandbox mode, but not in real life
I'm trying to enable Amazon IAP using Amazon's Unity plugin for IAP v1.0. The game uses Prime31 for Android and iOS stores, I'm implementing the Amazon IAP side-by-side with that. The purchase works fine with Amazon's SDK Tester (which provides a sandbox), but when I try it on the released game it fails. I don't have a Kindle Fire or such, but I install the game using the Amazon Store App onto my Android phone. Here is relevant logcat:
I/AmazonAppstore.BackoffRetryHandler(26295): Got a retry request
I/AmazonAppstore.BackoffRetryHandler(26295): Not retrying client error: 400
I/AmazonAppstore.BackoffRetryHandler(26295): Retrying request? false
E/AmazonAppstore.IAPErrorTypeInterceptor(26295): Received a service error in response: status code=400, message=1 validation error detected: Value '[]' at 'vendorSkuList' failed to satisfy constraint: Member must satisfy constraint: [Member must have length greater than or equal to 1]
E/AmazonAppstore.IAPErrorTypeInterceptor(26295): com.amazon.iap.client.exception.ServiceException: 1 validation error detected: Value '[]' at 'vendorSkuList' failed to satisfy constraint: Member must satisfy constraint: [Member must have length greater than or equal to 1]
E/AmazonAppstore.IAPErrorTypeInterceptor(26295): at com.amazon.iap.client.interceptor.IAPErrorTypeInterceptor.after(IAPErrorTypeInterceptor.java:71)
E/AmazonAppstore.IAPErrorTypeInterceptor(26295): at com.amazon.iap.client.util.Web.after(Web.java:295)
E/AmazonAppstore.IAPErrorTypeInterceptor(26295): at com.amazon.iap.client.util.Web.execute(Web.java:317)
E/AmazonAppstore.IAPErrorTypeInterceptor(26295): at com.amazon.iap.IAPClient.request(IAPClient.java:442)
E/AmazonAppstore.IAPErrorTypeInterceptor(26295): at com.amazon.iap.IAPClient.getProductsByVendorSku(IAPClient.java:328)
E/AmazonAppstore.IAPErrorTypeInterceptor(26295): at com.amazon.mas.client.iap.catalog.CatalogManagerImpl$GetProductsByVendorSku.getItems(CatalogManagerImpl.java:129)
E/AmazonAppstore.IAPErrorTypeInterceptor(26295): at com.amazon.mas.client.iap.catalog.CatalogManagerImpl.getItems(CatalogManagerImpl.java:103)
E/AmazonAppstore.IAPErrorTypeInterceptor(26295): at com.amazon.mas.client.iap.catalog.CatalogManagerImpl.getItems(CatalogManagerImpl.java:52)
E/AmazonAppstore.IAPErrorTypeInterceptor(26295): at com.amazon.mas.client.iap.purchase.AbstractPurchaseFragment$PurchaseInitiateMetric.doInBackground(AbstractPurchaseFragment.java:598)
E/AmazonAppstore.IAPErrorTypeInterceptor(26295): at com.amazon.mas.client.iap.purchase.AbstractPurchaseFragment$PurchaseInitiateMetric.doInBackground(AbstractPurchaseFragment.java:593)
E/AmazonAppstore.IAPErrorTypeInterceptor(26295): at android.os.AsyncTask$2.call(AsyncTask.java:288)
E/AmazonAppstore.IAPErrorTypeInterceptor(26295): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/AmazonAppstore.IAPErrorTypeInterceptor(26295): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AmazonAppstore.IAPErrorTypeInterceptor(26295): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AmazonAppstore.IAPErrorTypeInterceptor(26295): at java.lang.Thread.run(Thread.java:841)
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): Error determining item type when creating detail page
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): com.amazon.mas.client.iap.catalog.CatalogRequestException: com.amazon.iap.client.exception.ServiceException: 1 validation error detected: Value '[]' at 'vendorSkuList' failed to satisfy constraint: Member must satisfy constraint: [Member must have length greater than or equal to 1]
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): at com.amazon.mas.client.iap.catalog.CatalogManagerImpl.getItems(CatalogManagerImpl.java:105)
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): at com.amazon.mas.client.iap.catalog.CatalogManagerImpl.getItems(CatalogManagerImpl.java:52)
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): at com.amazon.mas.client.iap.purchase.AbstractPurchaseFragment$PurchaseInitiateMetric.doInBackground(AbstractPurchaseFragment.java:598)
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): at com.amazon.mas.client.iap.purchase.AbstractPurchaseFragment$PurchaseInitiateMetric.doInBackground(AbstractPurchaseFragment.java:593)
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): at android.os.AsyncTask$2.call(AsyncTask.java:288)
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): at java.lang.Thread.run(Thread.java:841)
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): Caused by: com.amazon.iap.client.exception.ServiceException: 1 validation error detected: Value '[]' at 'vendorSkuList' failed to satisfy constraint: Member must satisfy constraint: [Member must have length greater than or equal to 1]
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): at com.amazon.iap.client.interceptor.IAPErrorTypeInterceptor.after(IAPErrorTypeInterceptor.java:71)
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): at com.amazon.iap.client.util.Web.after(Web.java:295)
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): at com.amazon.iap.client.util.Web.execute(Web.java:317)
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): at com.amazon.iap.IAPClient.request(IAPClient.java:442)
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): at com.amazon.iap.IAPClient.getProductsByVendorSku(IAPClient.java:328)
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): at com.amazon.mas.client.iap.catalog.CatalogManagerImpl$GetProductsByVendorSku.getItems(CatalogManagerImpl.java:129)
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): at com.amazon.mas.client.iap.catalog.CatalogManagerImpl.getItems(CatalogManagerImpl.java:103)
E/AmazonAppstore.IAP/AbstractPurchaseFragment(26295): ... 8 more
W/BroadcastQueue( 831): Permission Denial: receiving Intent { act=com.amazon.venezia.command.analytics.LifecycleEvent flg=0x10 (has extras) } to com.amazon.venezia/com.amazon.mas.client.analytics.TailwindBroadcastReceiver requires com.amazon.mas.client.GLOBAL_BROADCAST-com.amazon.mShop.android due to sender com.amazon.mShop.android (uid 10016)
I/AmazonAppstore.BasicUserPreferences(26295): Reading from content://com.amazon.mas.client.settings/boolean/com.amazon.mas.client.framework.SettingsService.Collect3pAppUsage
It's coming from the guts of the Amazon IAPplugin parts from Unity. I call AmazonIAP.initiateItemDataRequest in the beginning of the game, with the list of the SKUs of my inventory. Seems like it returns fine. What else can I do? Any help is appreciated.
A fellow Unity developer advised to hack Amazon IAP 2.0 into the IAP 1.0 plugin. But it's not that easy, I'd have to replace the encompassed jar, rewrite the bindings...
Answer by csabatoth · Feb 19, 2015 at 11:43 PM
Refresh in-app-purchasing-1.0.3.jar
in the guts of the Unity plugin supplied by Amazon with in-app-purchasing-1.0.20.jar
. Besides that I added a call to initiateGetUserIdRequest
, not sure how much that matters: initiateItemDataRequest
worked before without that. So one of these changes or both of them made the headache go away. No I have 3 calls in the Unity game/app:
AmazonIAP.initiateItemDataRequest (QueryInventory ()); // QueryInventory is my own function, I know my inventory right now, I don't build it dynamically.
AmazonIAP.initiateGetUserIdRequest (); // Still during IAP initialization
AmazonIAP.initiatePurchaseRequest(itemID); // itemId is the SKU string
I utilize the AmazonIAPEventListener.cs
supplied by the IAP plugin almost as it is, I just needed to wire in the increase of the game's virtual currency:
void purchaseSuccessfulEvent( AmazonReceipt receipt ) {
AmazonIAP.Log("purchaseSuccessfulEvent: " + receipt );
PlayerCredits.AddPlayerCredits (receipt.sku);
}
Hope this helps others!
It's crazy that I can only test if the real IAP works well only if I publish the game and in production. It always worked fine with the Tester sandbox.
Your answer
Follow this Question
Related Questions
How do I implement In-App purchases for Windows/Windows Phone? 2 Answers
How to get local currency u3dxt 1 Answer
Windows Universal IAP 0 Answers
Where to put the Amazon App id to Unity 0 Answers