Amazon - Problem Initializing Unity IAP

Hello,

I am having some trouble initializing purchasing for Amazon. Previously we used Unity IAP 4.1.5 with Unity 2020.3.16f1, targeting Android API 30 w/ Gradle 4.0.

Now for the google billing deprecation we have updated these values to Unity IAP 4.5.2, Unity 2020.3.16f1, targeting Android API 32 w/ Gradle 7.0.2.

I get “PurchasingUnavailable” in my new builds; I have not changed anything regarding my purchasing initialization. I do not use codeless Unity IAP.

Everything works for Android and iOS, it is only Amazon that gives me the “PurchasingUnavailable” message.

Edit: I have found the issue to be the BillingMode.json. If I manually change it to target Amazon, purchasing initializes properly (however, it does take ~20 seconds).

My new problem is how to change the BillingMode during build time. I did try setting the android store in my build script but that did not work.

UnityPurchasingEditor.TargetAndroidStore(AppStore.AmazonAppStore); UnityPurchasingEditor.TargetAndroidStore(AppStore.AmazonAppStore);

I have modified my original post as I discovered it to be an issue with how BillingMode.json is set. How do I set this through a script rather than selecting it from a menu item?

I resolved this by adding an AMAZON_BUILD symbol to my build and then made a change in my build script along these lines:

#if AMAZON_BUILD
UnityPurchasingEditor.TargetAndroidStore(AppStore.AmazonAppStore);
#endif

var buildReport = BuildPipeline.BuildPlayer(buildPlayerOption);
2 Likes

This thread is now closed. Feel free to reach out via a new thread if you encounter further issues.
Thanks!