GetPricingPlan is only returning one plan

Hey there.

I’ve come across an odd situation in testing/building my site.
I have a user with a current paid member subscription. This user also has a canceled subscription and an expired subscription all of the same name - “Membership”

When I try to get this users subscription using getPricingPlans all that is returned is the expired plan.

below is my code

wixUsers.currentUser.getPricingPlans()
    .then((pricingPlans) => {
      console.log(pricingPlans);
      console.log("test");
      });

and the console output

and the user information to show they have more than one membership


Does anyone understand why the getPricingPlans function would only be returning the expired plan?

Hi sirbrad , I noticed the same thing a few weeks ago and could not find a workaround. Please let me know if you do find a solution. I’m speculating there is a bug on WIX’s backend code that retrieves the user’s paid plans data. Also, it would be great if WIX could also include “payment status” and “plan status” as part of the “PricingPlan” object that is returned by “getPricingPlans” - this way we can show our website clients their current status. And while we are at it, a WIX code function to cancel the members’ plan would be GREAT! Please let me know if you are able to find any solutions to these - I would GREATLY appreciate it!

Can you share the page that you are having a problem with?

Hi Steve, it’s not necessarily a page… it’s an issue with the “getPricingPlans” API. When we call that function and a user has multiple plans, it returns an object with a single pricing plan. In other words, we are expecting to see something like:

let first_plan = pricingPlans[0];
let second_plan = pricingPlans[1];
 

But “getPricingPlans” only returns the first one and nothing else. So if a user has an active plan, but has had previous expired plans, we can only see the expired plan - which isn’t very useful.

I understand you are experiencing a problem. But it’s difficult to diagnose unless the page with the problem is shared.

Hey Steve. Thanks for looking into it!
This page will have the code - its actually in the site js
https://sirbrad.wixsite.com/iakpproposal/account/my-account

Hi Steve, any updates on this issue? Really looking forward to your reply. Thanks in advance for your help!

[@aryjglantz] [@sirbrad] I’ll look tomorrow.

Two things come to mind.

  1. Are you calling the getpaidplans function in the $w.onReady function.

  2. Are the paid plans valid based on date.

The purpose of paid plans is to help manage access to pages allowed on the plan. If the plan has expired then you shouldn’t get access right?

Cheers
Syeve

Thanks, Steve.

  1. Yes, I am calling getpaidplans in the $w.onReady function and can access “pricingPlans[0]”. The issue we are having is that we are expecting “pricingPlans[1]”, “pricingPlans[2]”, etc. when multiple plans are in effect. But getpaidplans only shows the first one.

  2. When a paid plan member cancels, their plan remains active until the end of their plan period.

Let’s say a member subscribed on January 3rd and bought a one month membership. If they cancel their plan sometime in January, they still have access through February 3rd since they paid for it.

In the dashboard under “purchased plans”, their account “plan status” would show up as “pending cancellation” – rightfully so, as the system is waiting till the end of their plan period to cancel it. Calling “getpaidplans” will rightfully show the expiryDate the plan is set to expire.

HOWEVER, the problem now becomes if the member renews their plan. Calling “getpaidplans” will show their account is set to expire (the expiryDate of the FIRST plan)… and does NOT show their new plan.

So if we show the user expiryDate, they would think their account is going to expire when in fact they have renewed and are good to go. I would expect for “getpaidplans” to return ALL “active” AND “pending cancellation” plans the user has so I can loop through them.

As it stands, there is no way to let the user know what their current membership status is.

@aryjglantz So as I mentioned - using @sirbrad 's example above - you will only get valid paidplans returned in the call. If you look at the list above…


There are three paid plans here, for the selected user, but only one of them is valid. So this I believe is the answer for @sirbrad .

@aryjglantz what is the site you are having problems with? Can you share the paid plans you are testing with?

Cheers

@stevendc Hey steve, thanks for looking into this :slight_smile: The problem I’m having is that the pricing plan that is being returned when I call getPricingPlans is the one with expiry 23/01/2019, not the valid plan.

Let me drop you a chat

Notice how in the below example, the member “newemail” has an active plan… and a few canceled plans. Calling “getpricingplans” shows “expiryDate” as ‘2/9/2019’ from the OLDER plan (prior to the most recent one). I would expect “getpricingplans” to have an empty expiryDate - indicating the member is ACTIVE… or at least show multiple objects for each ‘active’ and ‘pending cancellation’ plans.

Hmm OK this is a little clearer. Let me experiment a little. If I can recreate this I’ll get our QA team involved. It does seem like a bug.

@stevendc thanks Steve!! Looking forward to your reply :slight_smile:

@aryjglantz I think I understand your current problem.
According to the paidPlans documentation :

For example, if you cancel a monthly plan in the middle of January, the plan continues until the end for January, but does not recur in the following months. During January, in this example, the Plan Status will be “Pending Cancellation”.
You have two identical plans (named: Paid Member ) that overlap

  • One “pending cancellation”: Jan 9 2019 → Feb 9 2019

  • One “until cancelled”: Feb 6 2019 ->…
    Technically the plan pending cancellation has not been cancelled so for the named plan you have configured it is the current plan. My guess, which you can test on Saturday is that the second plan will show up instead of the first which will have expired :-).

Cheers

@stevendc I understand that, but that is a problem. Because if I show the user the returned “expiryDate” that ‘getPricingPlans’ returns, it will show the user that their account is due to expire… when in fact, they have renewed their plan and will remain active. Instead, ‘getPricingPlans’ should return ALL objects showing ALL plans the user has. This way, I could loop through them and decide which expiryDate to show… giving my users an accurate account status.

@sirbrad Hi Brad?
OK I have managed to recreate the problem (during which time I also uncovered another bug that needs to be fixed). I will report to QA for assessment and let you know how things proceed.

Steve

Thanks Steve!! I really appreciate your help with this one! Much appreciated! :slight_smile:

@aryjglantz OK - yes that makes sense. Let me add that to the list!