I’m using Cordova, in app purchases work perfectly on iOS, however on Android i keep getting the following error when i try to make a purchase:
Cannot read properties of undefined (reading 'INAPP')
Obviously this is referring to Purchases.PURCHASE_TYPE.INAPP in the code below, but i cannot figure out a solution to this after a ton of googling and whatnot, can someone give me some suggestions/pointers please?
async function triggerPurchase(productId) {
if (device == "ios") {
const { customerInfo, productIdentifier } =
await Purchases.purchaseProduct(productId);
else if (device == "android") {
await Purchases.purchaseProduct(
productId,
({ productIdentifier, customerInfo }) => {},
({ error, userCancelled }) => {
},
null,
Purchases.PURCHASE_TYPE.INAPP
);
}