React-native-iap: getAvailablePurchases RETURN array empty [] despite I have completed successfully purchase both IOS and Android platform

Created on 24 Oct 2018  路  1Comment  路  Source: dooboolab/react-native-iap

Version of react-native-iap

"react-native-iap": "^2.3.12",

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

both

Expected behavior

array not empty

Actual behavior

[]

Tested environment (Emulator? Real Device?)

Iphone 6s and Samsung galaxy S6

Steps to reproduce the behavior

I have purchased completed one subscription on android and one non-renewable subscription on ios , then I use method getAvailablePurchases() to get information purchase but they return a array empty.

_getAvailablePurchases = async () => {
try {
const purchases = await RNIap.getAvailablePurchases();
console.info('Available purchases :: ', purchases);
} catch (err) {
console.log(err)
}

I am using account sandbox on IOS and Android

馃摫 iOS 馃檹 help wanted

Most helpful comment

One of the most asked questions in issues. I think I should write this up in Q&A soon. It will help you to understand the process of in-app purchase better if you read the official docs provided in each platform (android & ios).

getAvailablePurcahses is used only when you purchase a non-consumable product. This can be restored only. If you want to find out if a user subscribes the product, you should check the receipt which you should store in your own database. Apple suggests you handle this in your own backend to do things like what you are trying to achieve.

I'll close this issue soon.

>All comments

One of the most asked questions in issues. I think I should write this up in Q&A soon. It will help you to understand the process of in-app purchase better if you read the official docs provided in each platform (android & ios).

getAvailablePurcahses is used only when you purchase a non-consumable product. This can be restored only. If you want to find out if a user subscribes the product, you should check the receipt which you should store in your own database. Apple suggests you handle this in your own backend to do things like what you are trying to achieve.

I'll close this issue soon.

Was this page helpful?
0 / 5 - 0 ratings