React-native-iap: Am getting error : The sku was not found. Please fetch products first by calling getItems

Created on 25 Jun 2019  ·  5Comments  ·  Source: dooboolab/react-native-iap

3.0.0 of react-native-iap

0.57.8 of react-native

Platforms you faced the error (IOS or Android or both?)

Expected behavior

After successful subscribe get the receipt

Actual behavior

Subscription getting error
"The sku was not found. Please fetch products first by calling getItems"

Tested environment (Real Device)

Steps to reproduce the behavior

const itemSkus = Platform.select({
ios: [
''
],
android: [
'sub_1'
]
});

Step 1:
async componentDidMount() {
const msg = await RNIap.initConnection();
const items = await RNIap.getProducts(itemSkus);
RNIap.getProducts(items).then((products) => {
}).catch((error) => {
console.log("inApp getProducts error ",error.message);
})
}

Step 2: Call subscribe
_subscribe(){

  RNIap.buySubscription('sub_1').then(purchase => {
    console.log("inApp Subscription transactionReceipt ",purchase.transactionReceipt);
   }).catch((error) => {
    console.log("inApp Subscription error",error.message);
   })
}

it throws error "The sku was not found. Please fetch products first by calling getItems"

🙏 help wanted 🤖 android

Most helpful comment

You are buying subscription but using getProducts. Try using getSubscription instead.

All 5 comments

Same here

You are buying subscription but using getProducts. Try using getSubscription instead.

I am facing the same problem even when I use getSubscriptions. Why is there a issue with this as well. Any idea ? @hyochan

And if there is a complete implementation available for this package (especially for apple in-app) that you might have come across, can you provide a link for that.

await RNIap.initConnection();
const products = await RNIap.getSubscriptions(itemSkus);
const subs = await RNIap.getAvailablePurchases();

i use the above code its working fine.
but when i go to subscribe item its shows error that item not available. check below code for subscribe item

RNIap.requestSubscription(itemSkus[0]).then((result) => {
console.log('result request', result);
}).catch((e) => {
console.log('error request', e);
});

i also cross verified the itemSkus i am using

Facing the same issue with getSubscriptions but only on Android. Seems as if the function does not get invoked sometimes.

Was this page helpful?
0 / 5 - 0 ratings