Error - The Item that you were attempting to purchase could not be found

Hey All

I am trying to implement a subscription service in my Ionic 4 app. I am able to get the products from the play store, but when I try to subscribe to one of the products, I get the following: Error - The Item that you were attempting to purchase could not be found.

Your code / steps to reproduce

In the app.component.ts, I call the InAppPurchase.getProduct() method and all products are returned.

this.iap.getProducts([. . . products . . .])
      .then((products: InAppProductVO[]) => {
        console.log("Purchased Products: ", products);        
      })
      .catch((err) => {
        console.error("Failed to get purchases products", err);
        return Promise.reject(err);
      })

Then, when the user selects a subscription option, I do a check (still in progress, always fails) to see if they already have an active subscription. If not, I call the subscribe method.

this.iap.subscribe(productId)
          .then((product) => {
            // Don't get here :(
          })
          .catch((err) => {
            console.error(`Unable to purchase subscription - ${productId}: `, err);
            return loading.dismiss()
              .then(() => {
                return Promise.reject("You need to purchase this content to view it.");
              });
          })

Console output

I get the following on the device and no error messages returned in console.

Screenshot_2019-07-25-10-51-23

Type of product you are working with consumable/non-consumable/subscription

Product Type: Subscription

Version of cordova

Cordova CLI : 8.1.2 (cordova-lib@8.1.1)
Ionic CLI : 5.2.3

Version of iOS/Android

Android: 6.0.0

Additional Info

All my products are marked as active on the play store.
Billing is activated and an APK with the billing key has been uploaded and is published on the store.

I have tested the IAP (in-app-purchases) on multiple devices after Iwas able to get it to work on my bosses phone (FYI: Same code)

Working Devices:

  • Samsung s10 - Android 9.0, OneUI 1.1

Devices that aren’t working:

  • Samsung s8 - Android 9.0, OneUI 1.0
  • Huawei p9lite - Android 6.0, EMUI 4.1.3 (my device)
  • Samsung J5 Prime - Android 7.0, Samsung Experience 8.1

When it started to work on my bosses s10, I thought that it may have to do with the Huawei ban, but after not being able to get the IAP to work on 2 other Samsung’s, I do not believe that it is the issue after all. I shall continue to test and try different things and shall comment any findings here.

Has anybody had this error before and how were you able to resolve it?
Any help with this would be much appreciated.

FYI, this is a copy of the following Github issue of Alex Disler’s plugin. I am posting here to get it everywhere possible in the hope it will reach as many people as possible :slight_smile: .