Search Unity

Amazon: Unavailable product

Discussion in 'Unity IAP' started by Lesha-VH, Jul 9, 2019.

  1. Lesha-VH

    Lesha-VH

    Joined:
    Jul 3, 2012
    Posts:
    96
    UnityIAP version 1.22.0, Unity 2017.4.29f1

    Create empty project with ony one plug-in: UnityIAP
    Google Play store test application works fine.

    Amazon Store.
    Unity console shows: "Unavailable product" for each product.

    Logcat shows nothing interesting (Unity tag):
    "onGetUserIdResponse..."
    "Requesting 1 groups of skus"
    "onItemDataResponse..."
    "onPurchaseUpdatesRespose..."
    "Unavailable product..."

    Anyone manage to work Amazon with UnityIAP?
    I check and re-check everything 5 times or more... No ideas and nothing helps.
    Almost no information at amazon or Unity forum about bags - everything working (except for me))))
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  3. Lesha-VH

    Lesha-VH

    Joined:
    Jul 3, 2012
    Posts:
    96
    Jeff, integration is very simple...

    I have in logcat:

    Unity Purchasing Amazon
    onPurchaseUpdatesRespose


    (it comes from Unity activity, but only seen in native device log, not in Unity log)

    Could you tell me please, does this line in log means that plug-in correctly initialized and get response from Amazon store correctly?
     
    Last edited: Jul 10, 2019
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please put debug code in your OnInitialized callbacks to confirm. Debug.Log statements will show in logcat
     
  5. Lesha-VH

    Lesha-VH

    Joined:
    Jul 3, 2012
    Posts:
    96
    Jeff, I am using IAP Demo scene from plug-in

    In unity OnInitializeFailed() called. In console:
    "Billing failed to initialize!";
    "No products available for purchase!";


    But the question asked was DIFFERENT that you answered.

    When these lines printed to devices log by Unity IAP?

    Unity Purchasing Amazon
    onPurchaseUpdatesRespose
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I was encouraging you to review the documentation and debug. We haven't tested on Amazon for some time. You can't initialize IAP in the Editor, you can only use the fake store. You need to install on a device.
     
  7. Lesha-VH

    Lesha-VH

    Joined:
    Jul 3, 2012
    Posts:
    96
    the problem is in Amazon...

    In app purchases do not work in live testing and sandbox.
    In app purchases work in approved build that goes live.
     
  8. doubletapsoft

    doubletapsoft

    Joined:
    Sep 23, 2013
    Posts:
    32
    Were you able to figure out this issue? We are getting "Unavailable product" when initialization happens even though we have the proper items created in the Amazon Appstore dashboard.
     
  9. doubletapsoft

    doubletapsoft

    Joined:
    Sep 23, 2013
    Posts:
    32
    Have you tested on Amazon lately? We are getting "Unavailable product" and IAP are failing.
     
  10. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  11. doubletapsoft

    doubletapsoft

    Joined:
    Sep 23, 2013
    Posts:
    32
    Thanks for the response! Did it work on device with a valid Appstore configuration?
     
  12. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I'm not sure what you mean, I tested on an Amazon Fire tablet.
     
  13. doubletapsoft

    doubletapsoft

    Joined:
    Sep 23, 2013
    Posts:
    32
    Yes I just meant did you test using IAP that you created in your Amazon Appstore dashboard?
     
  14. doubletapsoft

    doubletapsoft

    Joined:
    Sep 23, 2013
    Posts:
    32
    When we call the below method we get the following error when building the APK:

    UnityEditor.Purchasing.UnityPurchasingEditor.TargetAndroidStore(UnityEngine.Purchasing.AppStore.AmazonAppStore);

    The type or namespace name 'Purchasing' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
     
    Last edited: Aug 3, 2021
  15. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    IAP would not be expected to work if it doesn't compile. Purchasing is not in UnityEditor, it's in UnityEngine. You switch the target platform from the menu option in the Unity Editor, not in code. Please compare to the Sample IAP Project v2 here https://forum.unity.com/threads/sample-iap-project.529555/#post-6950270
     
  16. doubletapsoft

    doubletapsoft

    Joined:
    Sep 23, 2013
    Posts:
    32
    Yes of course I understand IAP would not work if we can't compile the APK, since we wouldn't even have an APK to run on the device. But since it was not working via using the switch the target platform menu option. We followed the instructions here:


    https://docs.unity3d.com/Manual/UnityIAPAmazonConfiguration.html

    Is that method call no longer supported?
     
  17. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Why wasn't it working when you used the menu? Sorry I don't follow. Your error is separate from "switching platforms". What Amazon device are you testing on?
     
  18. doubletapsoft

    doubletapsoft

    Joined:
    Sep 23, 2013
    Posts:
    32
    "Why wasn't it working when you used the menu?" When we built the APK but only switching the target via the menu, we would get the "Unavailable product" on our Amazon Kindle Fire when we tried to use the IAP functionality. So I thought maybe we need to switch the target via the code as in the documentation.

    It appears the code in the documentation is obsolete. Because the same error also happens when I use it in your sample project. It would be nice if it worked so that we do not need to build a separate APK for Amazon and Google Play.

    Assets/Scripts/MyIAPManager.cs(38,9): error CS0234: The type or namespace name 'Purchasing' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
     
  19. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, your issue is separate from switching targets, just use the menu option. I would expect the behavior to be the same if you have not properly published your app.
     
  20. doubletapsoft

    doubletapsoft

    Joined:
    Sep 23, 2013
    Posts:
    32
    Is the documentation going to be fixed?
     
  21. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Hopefully, but in the meantime, I might suggest you focus on your IAP issue.
     
  22. doubletapsoft

    doubletapsoft

    Joined:
    Sep 23, 2013
    Posts:
    32
    Just wanted to make sure we are on the same page that the documentation is incorrect. We spent a few hours trying to get that call to work, I am sure other developers have as well.
     
  23. shochet

    shochet

    Joined:
    Dec 17, 2013
    Posts:
    30
    We are also seeing our Amazon IAP offers are broken. On device, when we initialize, all 18 subscription offers that used to work are "Unavailable product <product name>". Then "IAP failed to initialize: NoProductsAvailable"

    @JeffDUnity3D Is it really true that UnityPurchasingEditor.TargetAndroidStore(AndroidStore.AmazonAppStore) no longer works?

    We have an automated build that supports 4 different platforms, so using the menu option will not work for us.
    We're on Unity 2020.3.32 with IAP 4.1.4
     
  24. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Sorry, what is really true? Unavailable product is not related to switching platforms as been mentioned several times. Please compare to building directly from the Editor, as a test. But I doubt that is your issue. Simplify your issue, try with a single non-subscription product in a separate test project. I have confirmed that works.
     
  25. shochet

    shochet

    Joined:
    Dec 17, 2013
    Posts:
    30
    Thanks for the quick reply.
    Our same subscription offers work great on iOS and GooglePlay, and have worked on Amazon for over 4 years in production. In a recent release where we updated Unity/IAP we're now seeing only Amazon IAP broken.
    When we debugged with ADB on a development build we're seeing Unavailable product messages for all offers only on Amazon. We only have subscription products, so that's all I have tested.

    I thought from the thread above that you and @doubletapsoft had concluded the TargetAndroidStore API was not working and you must use the menu option - might have misread that.

    I'll see if I can create a small test case and submit a bug.
     
  26. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Where do you see that conclusion? So you see the same behavior when you do use the menu option? What Amazon device are you testing on?
     
  27. shochet

    shochet

    Joined:
    Dec 17, 2013
    Posts:
    30
    When I run the apk built by Unity the auto-generated fake amazon.sdktester.json looks wrong to me - notably the subscriptionParent field. I assume the other strings and price are just placeholders that do not matter (?)

    "annual7999_child": {
    "itemType":"SUBSCRIPTION",
    "title":"Fake title for Annual7999",
    "description":"Fake description for Annual7999",
    "price":"0.99",
    "smallIconUrl":"http:\/\/example.com",
    "subscriptionParent":"annual7999_child"}


    Here's the same excerpt from the official amazon.sdktester.json entry downloaded from our Amazon developer portal. Note the correct subscriptionParent sku string "annual7999_parent". Does that look like a problem to you?
    When I try to replace the amazon.sdktester.json with this correct one and run the app again it just gets replaced with the bad one above and IAP is still not initialized...

    "annual7999_child": {
    "smallIconUrl": "https://com-amazon-mas-catalog.s3.a...a8608fac95da_1c75e2e9e179d0e63e58cf30ea884f1e",
    "title": "codeSpark Academy Enrollment",
    "itemType": "SUBSCRIPTION",
    "price": 79.99,
    "description": "codeSpark Academy Enrollment",
    "languageTitleMap": {
    "US": "codeSpark Academy Enrollment"
    },
    "languageDescriptionMap": {
    "US": "codeSpark Academy Enrollment"
    },
    "currencyPriceMap": {
    "US": 0
    },
    "subscriptionParent": "annual7999_parent",
    "subscriptionBase": null,
    "term": "Annually"
    },


    The error I'm seeing is:
    W/Unity (12665): Unavailable product Annual7999-annual7999_child
    W/Unity (12665): IAP failed to initialize: NoProductsAvailable


    When I create a new empty project with a very simple IAP sample, it does not seem to install any amazon.sdktester.json on the device. Copying the correct json above allows IAP to be initialized correctly.

    We are testing on two different Amazon tablets:
    • Fire HDX 8.9 (3rd gen) / Fire OS 4.5.5.3
    • Fire HD 10 (7th gen) / Fire OS 5.7.0.0
    Thoughts? I realize this may not be fully related to the above thread, but it had the same symptoms.
    Thanks for the help!
     
  28. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  29. shochet

    shochet

    Joined:
    Dec 17, 2013
    Posts:
    30
    Ok I believe I found the source of my problem(s) in case they help somebody else:

    1) It appears that ProductDefinition.id on Amazon devices used to (erroneously) return the store specific parent sku id but now returns the cross platform id correctly. I had code that was expecting the parent sku id just on Amazon. I can remove that now!

    2) As per my post above, WriteSandboxJSON is a problematic if you have different ids for your parent and child ids in Amazon. It just writes out the store specific child id in the "subscriptionParent" field which will not work if that does not match the parent SKU you are using in the Amazon dashboard. That's ok I can stop using WriteSandboxJSON and just copy in the real json from the Amazon developer portal which has correct values.
     
    JeffDUnity3D likes this.
  30. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Favor, can you elaborate a bit more? If we are missing something in the documentation, we should get it added. Can you share your solution that works in both Sandbox and Release, perhaps share your AddProduct code in a generic way. Also the location within the project of the JSON files that you mentioned, including generic content? Thanks!
     
    Petr777 likes this.