[Solved] Unity IAP NoProductsAvailable on Amazon initialize

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:

public class UnityIAPProductIDs
{
    public string id;
    public string id_google;
    public string id_amazon = "";

    public UnityIAPProductIDs(string pId, string pId_google, string pId_amazon)
    {
        id = pId;
        id_google = pId_google;
        id_amazon = pId_amazon;
    }
}

void Initialize()
{
    List<UnityIAPProductIDs> ids = new List<UnityIAPProductIDs>();

    foreach (ProductIAP item in mySerializedProducts)
    {
        ids.Add(new UnityIAPProductIDs(item.id, item.iapIdProvider.googlePlay, item.iapIdProvider.amazon));
    }

    InitializeIAP(ids);
}

public void InitializeIAP(List<UnityIAPProductIDs> ids)
{
    // If we have already connected to Purchasing ...
    if (IsInitialized())
    {
        // ... we are done here.
        return;
    }

    // Create a builder, first passing in a suite of Unity provided stores.
    var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());

    foreach (UnityIAPProductIDs item in ids)
    {
        builder.AddProduct(item.id, ProductType.Consumable, new IDs()
        {
            { item.id_google , GooglePlay.Name },
            { item.id_amazon , AmazonApps.Name },
        });
    }

    UnityPurchasing.Initialize(this, builder);
}

public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
{
    // Overall Purchasing system, configured with products for this application.
    m_StoreController = controller;
    // Store specific subsystem, for accessing device-specific store features.
    m_StoreExtensionProvider = extensions;
 
    ...
}

public void OnInitializeFailed(InitializationFailureReason error)
{
    // Purchasing set-up has not succeeded. Check error for reason. Consider sharing this reason with the user.
    Debug.Log("OnInitializeFailed InitializationFailureReason:" + error);
}

This is how my products are serialized:

Right now i’m testing it with Amazon Test App (Amazon App Tester - App on Amazon Appstore).
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):
{"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:

OnInitializeFailed InitializationFailureReason:NoProductsAvailable

This is the log when i add a product:

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?

I found that it is throwing an exception before adding products and initializing iap. This is the exception:

Error parsing item data output
  java.lang.NumberFormatException: Invalid long: "19,99"
      at java.lang.Long.invalidLong(Long.java:124)
      at java.lang.Long.parse(Long.java:361)
      at java.lang.Long.parseLong(Long.java:352)
      at java.lang.Long.parseLong(Long.java:318)
      at java.math.BigDecimal.<init>(BigDecimal.java:344)
      at java.math.BigDecimal.<init>(BigDecimal.java:425)
      at com.amazon.device.iap.internal.a.c.a(SandboxRequestHandler.java:369)
      at com.amazon.device.iap.internal.a.c.d(SandboxRequestHandler.java:348)
      at com.amazon.device.iap.internal.a.c.c(SandboxRequestHandler.java:316)
      at com.amazon.device.iap.internal.a.c.a(SandboxRequestHandler.java:202)
      at com.amazon.device.iap.internal.d.a(PurchasingManager.java:130)
      at com.amazon.device.iap.ResponseReceiver.onReceive(ResponseReceiver.java:47)
      at android.app.ActivityThread.handleReceiver(ActivityThread.java:2512)
      at android.app.ActivityThread.access$1700(ActivityThread.java:145)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
      at android.os.Handler.dispatchMessage(Handler.java:102)
      at android.os.Looper.loop(Looper.java:145)
      at android.app.ActivityThread.main(ActivityThread.java:5266)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:515)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:826)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:642)
      at dalvik.system.NativeStart.main(Native Method)

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.

{"com.extremefungames.mototrafficrace2.pack4":{
  "itemType": "CONSUMABLE",
  "price": 10,
  "title": "p1",
  "description": "item_description",
  "smallIconUrl": "full_url_for_small_icon"
}}

Any ideas?

What country are you testing in? It looks like the decimal separator is a comma which might be causing the issue.

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?

1 Like

Yes, we are aware of the issue and working on it. I will check with the team here on status.

Thanks man

Upon further investigation, this looks to be thrown in the Amazon SDK in Java. This is also discussed on their Developer forums https://forums.developer.amazon.com/questions/16265/internal-price-parsing-error-in-amazoniapv2implget.html

I’ve migrated the IAP technology to Amazon IAP v2 (https://developer.amazon.com/public/apis/earn/in-app-purchasing/in-app-purchasing-unity-plug-in), which is the native IAP system of Amazon and works well, without errors on any language.

2 Likes