I have several offerings setup and my code looks similar to the example for react native although there is an extra error handle as not all cases are handled in the doc example (please see below)
What is happening is that I make the purchase, I get a pop up saying “You’re all set - your purchase was successful” but then the code checks typeof purchaserInfo.entitlements.activesthis.props.sku] !== 'undefined' and its undefined. So for some reason the purchase is happening but I’m not getting it added to my active entitlements. This error only happens around 50% of the time, so the fact it works sometimes has made it impossible to debug.
try {
const { purchaserInfo, productIdentifier } = await Purchases.purchasePackage(this.state.package);
if (typeof purchaserInfo.entitlements.activenthis.props.sku] !== 'undefined') {
this.completePurchase(this.props.sku); //Add to our database
} else {
Alert.alert('Oops!', 'We ran into an issue... please try again later.');
}
} catch (e) {
if (e.userCancelled) {
Alert.alert('Cancelled');
}
if (!e.userCancelled) {
Alert.alert('Oops!', 'There was an issue contacting the store, please try again later.');
}
}