Search Unity

[Solved] Unity IAP NoProductsAvailable on Amazon initialize

Discussion in 'Unity IAP' started by lorux, Oct 17, 2017.

Thread Status:
Not open for further replies.
  1. lorux

    lorux

    Joined:
    Feb 9, 2017
    Posts:
    31
    Hello, i've been struggling with IAP on Amazon. I've implemented Unity IAP system, which is working fine on Google Play, but i can't make it work on Amazon.

    I have added the IAP products into my Amazon console:




    I'm using Unity IAP 1.14.0. This is how i initialize IAP system:

    Code (CSharp):
    1. public class UnityIAPProductIDs
    2. {
    3.     public string id;
    4.     public string id_google;
    5.     public string id_amazon = "";
    6.  
    7.     public UnityIAPProductIDs(string pId, string pId_google, string pId_amazon)
    8.     {
    9.         id = pId;
    10.         id_google = pId_google;
    11.         id_amazon = pId_amazon;
    12.     }
    13. }
    14.  
    15. void Initialize()
    16. {
    17.     List<UnityIAPProductIDs> ids = new List<UnityIAPProductIDs>();
    18.  
    19.     foreach (ProductIAP item in mySerializedProducts)
    20.     {
    21.         ids.Add(new UnityIAPProductIDs(item.id, item.iapIdProvider.googlePlay, item.iapIdProvider.amazon));
    22.     }
    23.  
    24.     InitializeIAP(ids);
    25. }
    26.  
    27. public void InitializeIAP(List<UnityIAPProductIDs> ids)
    28. {
    29.     // If we have already connected to Purchasing ...
    30.     if (IsInitialized())
    31.     {
    32.         // ... we are done here.
    33.         return;
    34.     }
    35.  
    36.     // Create a builder, first passing in a suite of Unity provided stores.
    37.     var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
    38.  
    39.     foreach (UnityIAPProductIDs item in ids)
    40.     {
    41.         builder.AddProduct(item.id, ProductType.Consumable, new IDs()
    42.         {
    43.             { item.id_google , GooglePlay.Name },
    44.             { item.id_amazon , AmazonApps.Name },
    45.         });
    46.     }
    47.  
    48.     UnityPurchasing.Initialize(this, builder);
    49. }
    50.  
    51. public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
    52. {
    53.     // Overall Purchasing system, configured with products for this application.
    54.     m_StoreController = controller;
    55.     // Store specific subsystem, for accessing device-specific store features.
    56.     m_StoreExtensionProvider = extensions;
    57.  
    58.     ...
    59. }
    60.  
    61. public void OnInitializeFailed(InitializationFailureReason error)
    62. {
    63.     // Purchasing set-up has not succeeded. Check error for reason. Consider sharing this reason with the user.
    64.     Debug.Log("OnInitializeFailed InitializationFailureReason:" + error);
    65. }
    This is how my products are serialized:



    Right now i'm testing it with Amazon Test App (http://www.amazon.com/Amazon-App-Tester/dp/B00BN3YZM2/).
    The device specs:
    - Kindle Fire hdx 8,9 3rd gen
    - Fire OS 4.5.5.2
    This is the .json file located in device internal memory (downloaded directly from Amazon console):

    Code (CSharp):
    1. {"com.extremefungames.mototrafficrace2.pack4":{"smallIconUrl":"http://","price":19.99,"itemType":"CONSUMABLE","title":"Case Of Coins","description":"—","languageDescriptionMap":{"US":"—"},"languageTitleMap":{"US":"—"},"currencyPriceMap":{"BR":63.58,"DE":16.93,"AU":25.7,"IN":1305.05,"JP":2248.0,"GB":15.14,"IT":16.93,"CN":131.0,"FR":16.93,"CA":25.02,"ES":16.93,"US":19.99}},"com.extremefungames.mototrafficrace2.pack3":{"smallIconUrl":"https://s3-external-1.amazonaws.com/com-amazon-mas-catalog/M1D519R59QMQ97%2FM1ZIR04S7NPVDC%2Fimages%2F_3f996a98-3925-4b38-9743-2e22dc5763bf_f13415bd75a40f512c0e729addd03b07","price":7.99,"itemType":"CONSUMABLE","title":"Bag Of Coins","description":"Bag Of Coins","languageDescriptionMap":{"US":"Bag Of Coins"},"languageTitleMap":{"US":"Bag Of Coins"},"currencyPriceMap":{"BR":25.47,"DE":6.81,"AU":10.3,"IN":522.23,"JP":900.0,"CN":53.0,"IT":6.81,"GB":6.08,"FR":6.81,"ES":6.81,"CA":10.03,"US":7.99}},"com.extremefungames.mototrafficrace2.pack2":{"smallIconUrl":"http://","price":3.99,"itemType":"CONSUMABLE","title":"Pile Of Coins","description":"—","languageDescriptionMap":{"US":"—"},"languageTitleMap":{"US":"—"},"currencyPriceMap":{"BR":12.69,"DE":3.38,"AU":5.13,"IN":260.49,"JP":449.0,"IT":3.38,"CN":26.0,"GB":3.02,"FR":3.38,"CA":4.99,"ES":3.38,"US":3.99}},"com.extremefungames.mototrafficrace2.removeads":{"smallIconUrl":"http://","price":0.99,"itemType":"CONSUMABLE","title":"Remove Ads","description":"—","languageDescriptionMap":{"US":"—"},"languageTitleMap":{"US":"—"},"currencyPriceMap":{"BR":3.15,"DE":0.84,"AU":1.27,"IN":64.63,"JP":111.0,"GB":0.75,"CN":7.0,"IT":0.84,"FR":0.84,"US":0.99,"ES":0.84,"CA":1.24}},"com.extremefungames.mototrafficrace2.pack1":{"smallIconUrl":"http://","price":0.99,"itemType":"CONSUMABLE","title":"Stack Of Coins","description":"—","languageDescriptionMap":{"US":"—"},"languageTitleMap":{"US":"—"},"currencyPriceMap":{"BR":3.15,"DE":0.84,"AU":1.27,"IN":64.63,"JP":111.0,"GB":0.75,"IT":0.84,"CN":7.0,"FR":0.84,"CA":1.24,"ES":0.84,"US":0.99}},"com.extremefungames.mototrafficrace2.revive":{"smallIconUrl":"http://","price":1.99,"itemType":"CONSUMABLE","title":"Revives","description":"—","languageDescriptionMap":{"US":"—"},"languageTitleMap":{"US":"—"},"currencyPriceMap":{"BR":6.33,"DE":1.69,"AU":2.56,"IN":129.92,"JP":224.0,"CN":13.0,"IT":1.69,"GB":1.51,"FR":1.69,"ES":1.69,"CA":2.49,"US":1.99}},"com.extremefungames.mototrafficrace2.starterpack2":{"smallIconUrl":"http://","price":4.99,"itemType":"CONSUMABLE","title":"Starter pack 2","description":"—","languageDescriptionMap":{"US":"—"},"languageTitleMap":{"US":"—"},"currencyPriceMap":{"BR":15.87,"DE":4.23,"AU":6.42,"IN":325.77,"JP":561.0,"CN":33.0,"IT":4.23,"GB":3.78,"FR":4.23,"US":4.99,"ES":4.23,"CA":6.24}},"com.extremefungames.mototrafficrace2.starterpack1":{"smallIconUrl":"http://","price":1.99,"itemType":"CONSUMABLE","title":"Starter Pack 1","description":"—","languageDescriptionMap":{"US":"—"},"languageTitleMap":{"US":"—"},"currencyPriceMap":{"BR":6.33,"DE":1.69,"AU":2.56,"IN":129.92,"JP":224.0,"GB":1.51,"IT":1.69,"CN":13.0,"FR":1.69,"ES":1.69,"US":1.99,"CA":2.49}},"com.extremefungames.mototrafficrace2.multiplicadorcoins":{"smallIconUrl":"http://","price":2.99,"itemType":"CONSUMABLE","title":"Multiplicador coins","description":"—","languageDescriptionMap":{"US":"—"},"languageTitleMap":{"US":"—"},"currencyPriceMap":{"BR":9.51,"DE":2.53,"AU":3.84,"IN":195.2,"JP":336.0,"GB":2.26,"CN":20.0,"IT":2.53,"FR":2.53,"US":2.99,"ES":2.53,"CA":3.74}}}
    I get this log when IAP initializes:

    Code (CSharp):
    1. OnInitializeFailed InitializationFailureReason:NoProductsAvailable
    This is the log when i add a product:

    Code (CSharp):
    1. Unavailable product
    I've tried reinstalling Amazon Test App but did no difference.
    I've targeted the IAP to Amazon on IAP settings.
    I've tried testing out with an app configured as live testing in console.
    I've tried adding products to IAP Product Catalog.
    What can be wrong here?
     
    Last edited: Oct 17, 2017
  2. lorux

    lorux

    Joined:
    Feb 9, 2017
    Posts:
    31
    I found that it is throwing an exception before adding products and initializing iap. This is the exception:
    Code (CSharp):
    1.  
    2. Error parsing item data output
    3.   java.lang.NumberFormatException: Invalid long: "19,99"
    4.       at java.lang.Long.invalidLong(Long.java:124)
    5.       at java.lang.Long.parse(Long.java:361)
    6.       at java.lang.Long.parseLong(Long.java:352)
    7.       at java.lang.Long.parseLong(Long.java:318)
    8.       at java.math.BigDecimal.<init>(BigDecimal.java:344)
    9.       at java.math.BigDecimal.<init>(BigDecimal.java:425)
    10.       at com.amazon.device.iap.internal.a.c.a(SandboxRequestHandler.java:369)
    11.       at com.amazon.device.iap.internal.a.c.d(SandboxRequestHandler.java:348)
    12.       at com.amazon.device.iap.internal.a.c.c(SandboxRequestHandler.java:316)
    13.       at com.amazon.device.iap.internal.a.c.a(SandboxRequestHandler.java:202)
    14.       at com.amazon.device.iap.internal.d.a(PurchasingManager.java:130)
    15.       at com.amazon.device.iap.ResponseReceiver.onReceive(ResponseReceiver.java:47)
    16.       at android.app.ActivityThread.handleReceiver(ActivityThread.java:2512)
    17.       at android.app.ActivityThread.access$1700(ActivityThread.java:145)
    18.       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
    19.       at android.os.Handler.dispatchMessage(Handler.java:102)
    20.       at android.os.Looper.loop(Looper.java:145)
    21.       at android.app.ActivityThread.main(ActivityThread.java:5266)
    22.       at java.lang.reflect.Method.invokeNative(Native Method)
    23.       at java.lang.reflect.Method.invoke(Method.java:515)
    24.       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:826)
    25.       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:642)
    26.       at dalvik.system.NativeStart.main(Native Method)
    27.  
    Looks like its having trouble to parse products data? Not sure how or where Unity gets this data? I've tried writing amazon.sdktester.json manually with 1 product but did not difference.
    Code (CSharp):
    1. {"com.extremefungames.mototrafficrace2.pack4":{
    2.   "itemType": "CONSUMABLE",
    3.   "price": 10,
    4.   "title": "p1",
    5.   "description": "item_description",
    6.   "smallIconUrl": "full_url_for_small_icon"
    7. }}
    Any ideas?
     
    Last edited: Oct 18, 2017
  3. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    What country are you testing in? It looks like the decimal separator is a comma which might be causing the issue.
     
  4. lorux

    lorux

    Joined:
    Feb 9, 2017
    Posts:
    31
    Finally solved the issue. I think the cause of the problem was the device's language. Not sure what was the country configured.. but i changed the account, set it in USA and changed the language to English (it was in Spanish).

    So being this the solution, Unity IAP Amazon will work on every country/language?
     
    Last edited: Oct 18, 2017
    nicholasr likes this.
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, we are aware of the issue and working on it. I will check with the team here on status.
     
  6. lorux

    lorux

    Joined:
    Feb 9, 2017
    Posts:
    31
    Thanks man
     
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  8. lorux

    lorux

    Joined:
    Feb 9, 2017
    Posts:
    31
    ap-unity and nicholasr like this.
Thread Status:
Not open for further replies.