I have the following code, essentially straight from the documentation using react-native-purchases
const PackageItem = ({ purchasePackage, setIsPurchasing, styles }) => {
const {
product: { title, description, priceString },
} = purchasePackage;
const navigation = useNavigation();
const onSelection = async () => {
setIsPurchasing(true);
console.log('being Purchase');
try {
const { purchaserInfo } = await Purchases.purchasePackage(purchasePackage);
console.log('try purchase...');
if (typeof purchaserInfo.entitlements.activei'Pro'] !== 'undefined') {
console.log('User has All Access');
// navigation.goBack();
}
} catch (e) {
if (!e.userCancelled) {
console.log('error: ', e);
Alert.alert('Error purchasing package', e.message);
}
} finally {
setIsPurchasing(false);
}
};
```
When I click on the subscribe button, I go through the dialogue and sign in and the subscription starts to process. However, once it begins to finish the transaction, it stops at the
```
if (typeof purchaserInfo.entitlements.activea'Pro'] !== 'undefined') {
```
line and returns the following error:
```
tTypeError: undefined is not an object (evaluating 'purchaserInfo.entitlements')]
```
The entitlement that I have my products and offerings under is called ‘Pro’, so I’m not sure why this error is getting returned.