亚马逊 IAP 在沙盒模式下工作,但在现实生活中不行

Amazon IAP works in sandbox mode, but not in real life

我正在尝试为 Unity 游戏启用 Amazon IAP。目前 Unity 插件仅适用于 Amazon IAP v1.0。该游戏将 Prime31 用于 Android 和 iOS 商店,我正在与它并排实施亚马逊 IAP。 购买与亚马逊的 SDK 测试器(提供沙盒)配合使用时效果很好,但是当我在已发布的游戏上尝试时却失败了。我没有 Kindle Fire 或类似设备,但我使用亚马逊商店应用程序将游戏安装到我的 Android phone 上。这是相关的 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.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.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

它来自 Unity 的 Amazon IAPplugin 部分的核心。我在游戏开始时使用我库存的 SKU 列表调用 AmazonIAP.initiateItemDataRequest。好像returns 不错。我还可以做些什么? 感谢任何帮助。

一位 Unity 开发人员建议将 Amazon IAP 2.0 破解到 IAP 1.0 插件中。但这并不容易,我必须更换包含的罐子,重写绑定...

刷新 in-app-purchasing-1.0.3.jar 亚马逊提供的 Unity 插件 in-app-purchasing-1.0.20.jar。除此之外,我添加了一个对 initiateGetUserIdRequest 的调用,但不确定这有多重要:initiateItemDataRequest 之前没有它就可以工作。 因此,这些变化之一或两者都使头痛消失了。 不,我在 Unity 中有 3 个调用 game/app:

  1. AmazonIAP.initiateItemDataRequest (QueryInventory ()); // QueryInventory is my own function, I know my inventory right now, I don't build it dynamically.
  2. AmazonIAP.initiateGetUserIdRequest (); // Still during IAP initialization
  3. AmazonIAP.initiatePurchaseRequest(itemID); // itemId is the SKU string

我几乎直接使用IAP插件提供的AmazonIAPEventListener.cs,我只需要连接游戏虚拟货币的增加:

void purchaseSuccessfulEvent( AmazonReceipt receipt ) {
    AmazonIAP.Log("purchaseSuccessfulEvent: " + receipt );
    PlayerCredits.AddPlayerCredits (receipt.sku);
}

希望这对其他人有帮助!