After successful subscribe get the receipt
Subscription getting error
"The sku was not found. Please fetch products first by calling getItems"
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"
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.
Most helpful comment
You are buying subscription but using
getProducts
. Try usinggetSubscription
instead.