Question

In app purchases work fine on iOS, but getting the following error on android: Cannot read properties of undefined (reading 'INAPP'

  • 28 September 2023
  • 1 reply
  • 142 views

Badge +1

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
);

}

 


1 reply

Userlevel 4
Badge +6

Hey There,

 

INAPP is supported in cordova. Can you please send some debug logs of what the error that comes back looks like? 

You can enable debug logs by following this guide. After they're enabled you'll see logs like this in the console:

[Purchases] - DEBUG: No cached entitlements, fetching
[Purchases] - DEBUG: GET /v1/subscribers/<APP_USER_ID> 200
[Purchases] - DEBUG: Purchaser info updated, sending to delegate


Please ensure the debug logs include the entire app life-cycle, including the messages printed during initialization of the SDK. The more information you include here, the better we'll be able to help.

Reply