Solved

Testing Get Offerings on Amazon Kindle showing PurchaseNotAllowedError

  • 12 December 2021
  • 9 replies
  • 290 views

Badge +4

I’ve prepared my Amazon app to use RevenueCat for my app subscription and run into the following issue. (Details on the steps I’ve done are show below the description of the issue I am having)

 

When trying to retrieve the offering in my app on an Kindle Fire Tablet, using 

Purchases.getSharedInstance().purchasePackage(SettingsSubscription.this,packageOffer1, new MakePurchaseListener() {    @Override    public void onCompleted(@NonNull Purchase purchase,                            @NonNull PurchaserInfo purchaserInfo) {

        }

    @Override    public void onError(@NonNull PurchasesError error,                        boolean userCancelled) {        // No purchase      }});

I receive the following error in the onError method.

ERROR: 🤖‼️ Error fetching offerings - PurchasesError(code=PurchaseNotAllowedError, underlyingErrorMessage=Billing is not available in this device. DebugMessage: Billing service unavailable on device.. ErrorCode: BILLING_UNAVAILABLE., message='The device or user is not allowed to make the purchase.')

However, when testing using my old Amazon IAP SDK, the testing of IAP subscription items works fine.

 

I’ve done the following items to prepare my Amazon app to use RevenueCat

  1. Added the following the the Gradle file
implementation 'com.revenuecat.purchases:purchases:4.3.1'implementation 'com.revenuecat.purchases:purchases:5.0.0-amazon.alpha.3'implementation 'com.revenuecat.purchases:purchases-store-amazon:5.0.0-amazon.alpha.3'
  1. I’ve also added an Amazon section to my App Project and added the Amazon Secret and package name.  Also added the subscription item and added it to the current offering.
  1. I have installed the Amazon Tester App (latest version) and copied the Subscription JSON file from the Amazon Store to the Kindle Tablet and the subscription info does show on the Amazon Tester App.
  2. Does the following code need to be in the app Manifest file.  It was needed when using the Amazon IAP directly, so I’ve left it. 
    <receiver android:name = "com.amazon.device.iap.ResponseReceiver"    android:permission = "com.amazon.inapp.purchasing.Permission.NOTIFY"    android:exported = "true">    <intent-filter>        <action android:name = "com.amazon.inapp.purchasing.NOTIFY" />    </intent-filter></receiver>

 

 

Some possible issues.

  1.  My app compileSDK and targetSDK is 31 (What SDK has RevenueCat tested with)
  1. I am using the  in-app-purchasing-2.0.76.jar.  However there is a new Amazon SDK jar file that Amazon is transitioning to.  I think there are some changes to the SANDBOX mode.

  https://developer.amazon.com/docs/in-app-purchasing/transitioning-to-appstore-sdk.html

  1. I haven’t specifically run ADB to put the tablet in Sandbox mode, but since it is running a debug version of my app, it should already be in sandbox mode. This in confirmed when I check the ‘PurchasingService.IS_SANDBOX_MODE’ variable.
icon

Best answer by Maddie 20 December 2021, 23:19

View original

9 replies

Userlevel 3
Badge +3

Hey @Glen B.,

Thanks for outlining your issue so clearly! The error log you’re seeing occurs when trying to access Google’s BillingClient. Make sure you use the AmazonConfiguration object to initialize Purchases:

Purchases.configure(AmazonConfiguration.Builder(this, "amazon_api_key").build())

Initializing that way will ensure we call the Amazon IAP library and not BillingClient. I think that should fix the issue -- let me know if it doesn’t.

 

As for the manifest question -- We add that Receiver for you through our SDK, but there was a bug brought to our attention about missing the “exported” attribute. That would cause a build error for apps targeting 31+. Since you’ve added that bit yourself, it wasn’t a problem for you. We are about to push a hotfix, 5.0.0-amazon.alpha.5, with all the proper attributes. Feel free to remove the manifest code you posted above, if you upgrade to alpha.5!

 

And as for the IAP version -- keep an eye out for a release from us with this update soon :) 

Badge +4

Thanks.  I had not used the AmazonConfiguration.Builder, just replaced the Google api with the amazon one.  I have updated the app to use the AmazonConfiguration.Builder format you mention above (just had to add a new in there, as shown below.

Purchases.configure(new AmazonConfiguration.Builder(this, "amazon_api_key").build())

 

Now the Purchases does try to load the offering, but the offering is null.  I am using a Kindle Fire OS device and the Amazon Tester app, with the JSON file of my only Subscription IAP for the app.

One question I have is that Amazon subscriptions require an SKU and a Subscription Parent SKU.  The RevenueCat screen for Amazon in the app section seems to just require the subscription SKU and there is no reference to the parent SKU. 

I will also try to submit a build for the Live Testing as see what results I get there in terms of retrieving the current Amazon offering.

Userlevel 3
Badge +3

Hi @Glen B., glad that fixed your issue! As for the null offerings, and your question -- make sure you enter the term sku into the RevenueCat dashboard, not the parent IAP sku. Let me know if you are still having issues!

 

 

Badge +4

Thanks.  I do hav the term sku entered, but still no luck.  However, I’m even having issues with getting the price of the sku from my own original code.  This is with a fire tablet and the App Tester...but when doing the Live Testing it works.  I am migrating to the Amazon AppStore SDK and getting it using maven repository.

implementation 'com.amazon.device:amazon-appstore-sdk:3.0.2'

And just a note about the receiver code in the manifest. Amazon had it setup incorrectly in the docs for a while and it was recently updated.  The correct version is shown below...originally they had the permission line inside the intent-filter.  

<receiver    android:name = "com.amazon.device.iap.ResponseReceiver"    android:permission = "com.amazon.inapp.purchasing.Permission.NOTIFY"    android:exported = "false">    <intent-filter>        <action            android:name = "com.amazon.inapp.purchasing.NOTIFY"/>    </intent-filter></receiver>

 

I’ll wait a bit longer and see how your updates go and then try to integrate with revenuecat and do some live testing and see if that works on my Kindle Fire device.

Userlevel 3
Badge +3

@Glen B. thanks for the heads up, let me know how things go. We are working on a release pulling the latest amazon SDK from maven.

Badge +4

Hi,

I’m back to trying out the Amazon integration and running into some issues.

Background info:

  1. In the gradle file I’m using the latest purchases version:  
implementation 'com.revenuecat.purchases:purchases:5.0.0'implementation 'com.revenuecat.purchases:purchases-store-amazon:5.0.0'
  1. I have the jar file amazon-appstore-sdk-3.0.2.jar in the libs folder
  1. I’ve removed the response receiver code in the app manifest file 
    "com.amazon.device.iap.ResponseReceiver"

 

When using the code below

Purchases.configure(new AmazonConfiguration.Builder(this, "public_amazon_sdk_key").build());

I am receiving the message ‘Cannot resolve method 'build' in 'Builder'’. 

 

Userlevel 3
Badge +3

Hi Glen,

 

You shouldn’t need the jar anymore with the latest version of purchases-android. Can you try removing that and see if it fixes things?

I’m also getting an empty Offering. Any insight into this?

{“offerings”: {“all”:{}, “current”:null}}

 

Update:

Just went to Live App Testing and it’s working. 👍

I suggest skipping the App Tester 

Reply