Getting member planId

Hey there :raised_hand_with_fingers_splayed:

Glad you’re back, and welcome again.

Basically, after getting all the plans of a given user, loop through them and check against their IDs, if one matches then check the status of that plan, the thing is, you cannot get the ID of the plan when getting the user plans - which is a shame. however, you can get the name of the plan, I know, I know, it’s not the most accurate way, but it is what it is.

user.getPricingPlans().then(plans => {    
    const time = new Date().getTime();
    
    // Get only the active plans;
    plans.filter(items => items.expiryDate.getTime() < time);
    
    // Get the plan that matches the specified name
    plans.filter(items => items.name === 'Premium Plan');
    
    /* Now check if there are any items in the plans array, if there are 
    any items left, then the plan is found and is active */
    
    if (plans.length > 0) {
        // The user has an active plan;
    } else {
        // User doesn't have an active plan
    }
})

Hope this helps~!
Ahmad