Amazon IAP在沙盒模式下工作,但在现实生活中却不行

时间:2015-02-16 22:19:55

标签: unity3d in-app-purchase amazon

我正在尝试为Unity游戏启用Amazon IAP。目前Unity插件仅适用于Amazon IAP v1.0。游戏使用Prime31用于Android和iOS商店,我正在实现亚马逊IAP。 购买适用于亚马逊的SDK测试程序(提供沙盒),但是当我在发布的游戏上尝试它时,它失败了。我没有Kindle Fire等,但我使用亚马逊商店应用程序将游戏安装到我的Android手机上。这是相关的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

它来自Unity的Amazon IAPplugin部分。我在游戏开始时使用我的库存SKU列表调用AmazonIAP.initiateItemDataRequest。好像它返回正常。我还可以做些什么? 任何帮助表示赞赏。

Unity开发人员建议将Amazon IAP 2.0入侵IAP 1.0插件。但这并不容易,我必须更换包含的jar,重写绑定......

1 个答案:

答案 0 :(得分:0)

在亚马逊提供的in-app-purchasing-1.0.3.jar提供的Unity插件的内容中刷新in-app-purchasing-1.0.20.jar。除此之外,我添加了对initiateGetUserIdRequest的调用,不知道重要的是多少:initiateItemDataRequest之前没有它。 因此,这些变化中的一个或两个都使头痛消失了。 不,我在Unity游戏/应用程序中有3个电话:

  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
  4. 我使用IAP插件提供的AmazonIAPEventListener.cs几乎就是这样,我只需要增加游戏的虚拟货币:

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

    希望这有助于其他人!