Stripe price is not update properly in Membership 2 Pro

Existing customers are still getting charged $49.99/mo rather than the new price $54.99. We need to update existing subscribers on Stripe to be charged the new amounts on future invoices.

  • Adam Czajczyk
    • Support Gorilla

    Hello David @ BBS

    I hope you're well today!

    The payment subscription is always created on Stripe's end, not the plugin end. That means that recurring payments are always initiated by the Stripe on a set basis.

    Changing any payment settings for a membership that already has paying members will affect only the new invoices and not existing ones so if there were already invoices created for some members for future payments (waiting to be paid) they won't be updated.

    However, if it comes to future invoices - so invoices created in Stripe/by Stripe in future, after those already created are past due - we've setup some tests to double-check it. I realize it's a pressing issue but we need to test what's happening and why. Due to the Stripe subscription invoicing process the shortest testing time we were able to set means we need to wait for results until the day after tomorrow and we'll know more about the issue. I'm sorry it will take time and I'd appreciate some patience.

    We'll update you here as soon as we get to know more about the case.

    Kind regards,
    Adam

  • David @ BBS
    • Site Builder, Child of Zeus

    Hi Adam,

    Since the description on this ticket create by your colleague is very vague and incorrectly describes the issue I will re-write it here:

    Changing the price of a membership plan updates nicely in the Membership 2 plugin itself. And as you described, all future invoices are generated with the updated price. Running the “&fixsub=1” workaround re-synchronizes the plans with Stripe, which effectively updates the plan’s price on Stripe, however, all existing customers continue to be charged the old price, Stripe doesn’t update their price.

    I have since reached out to Stripe to assist with this and got clarification as to what the exact problem is. It looks like the plugin deletes the old plan and created a new one with the same ID but a new price. Unfortunately, this causes a bunch of issues, including different users at different price points. The reason being, that existing users have to be updated to the new plan, but never are. Ultimately it can be done manually, by going to each users’ subscription page and hitting the “update subscription” button and saving without generating a new invoice, or (in the case of Membership 2) should be done via the API, where all users on the old plan are updated to the new plan (with the new price). See here for details on getting that setup via the API:
    https://stripe.com/docs/billing/subscriptions/products-and-plans#changing-and-deleting-plans

    Currently, after the price change, we’ve got close to a hundred users that need to be updated to use the new pricing on Stripe. So a fast fix on this would be highly appreciated.

  • David @ BBS
    • Site Builder, Child of Zeus

    And to clarify further, the one thing they've pointed out (which the doc above also specifies) is that while updating pricing, the plugin should create a new plan with a new ID on Stripe rather than reusing the old one ID. That's what caused these phantom user subscriptions.

  • Panos
    • SLS

    Hi David @ BBS ,

    Thanks for all the feedback :slight_smile:

    Of what it seems it wasn't initially been designed to update the prices for existing Members. For those the Subscription needs to be cancelled and member needs to re-subscribe on that Membership with the new price. To me it makes sense as members have agreed to subscribe to the initial price.

    I'm considered about what you mentioned about phantom user subscriptions. Could you provide more info what you mean about those? They are the Customers with the old Plan and not being charged at all? Could you share some info about what you have noticed about them?

    In case you are still interested, I prepared a mu-plugin that should override default method and would create a new Pricing Plan after updating the price in a Membership. Then it updates all Subscriptions of that Membership to the new Plan, so all Customers are charged the new amount. You can download that mu-plugin from here :
    https://gist.github.com/wpmudev-sls/8ee83a8917d9369ddf142e0d26c68dc4
    unzip it and upload wpmudev-ms-update-stripe-plans.php to your wp-content/mu-plugins folder. You can create that folder if it doesn't exist.

    This should be first tested on a testing/staging site with dummy members. I have been testing this extensively, but this is an unofficial fix and for your security you need to first test this out before applying on your live site, as this is about payment details.

    Kind regards!

  • Panos
    • SLS

    I also forgot to mention that this requires one more change to do. Open file:
    wp-content/plugins/membership-pro/premium/gateway/stripeplan/class-ms-gateway-stripeplan.php

    and find line :
    static public function get_the_id( $id, $type = 'item' ) {
    Right after that line add:

    if ( 'plan' == $type ) {
    			$plan_id = get_post_meta( $id, '_ms_stripeplan_plan_id', true );
    			if ( ! empty( $plan_id ) ) {
    				return $plan_id;
    			}
    		}

    If this is out of your comfort zone we could do those changes for you, but we need admin and ftp access to a staging site, and we can later on move it to your live site. You can send in the stagin's site credentials privately through our contact form: https://premium.wpmudev.org/contact/#i-have-a-different-question

    Send in:Subject: "Attn: Panos Lyrakis"

    - Admin login:
    Admin username
    Admin password
    Login url

    - FTP credentials
    host
    username
    password
    (and port if required)

    - link back to this thread for reference

  • David @ BBS
    • Site Builder, Child of Zeus

    Hi Panos!

    Thanks for chiming in with a possible solution. Looks like the new updated

    Take a look at user 651:
    –I subscribed this test user to a Stripe subscription. Worked well.
    –I changed the price on the plan on our website. The new mu-plugin and code took care of creating a new pricing plan for the same membership. Worked really well.
    –However, the user wasn't re-assigned to the new pricing plan. :disappointed:
    –I ran the "&fixsub=1" re-sync in hopes that that would move the customer over to the new pricing plan, but it didn't.

    So now we're just missing the option to switch the customers over to the new updating pricing plan. How can we achieve that?

    _________

    As for the phantom users, in theory, the moving all users to the new pricing plan should take care of these. But let me explain what the "phantom user" issue anyway: ultimately what it means is that we had users who were subscribed to our "Family" plan. When we switched the pricing on the plan, Membership2 plugin created a new plan on Stripe with the same ID, but never updated the users. As such, when I go to https://dashboard.stripe.com/subscriptions I can see all my active subscriptions. Including over two dozen users that are part of the “Family” plan (remember, previously the plugin created new plans with the same product/id, so it shows users who are subscribed to the new and old "Family" plan alike). However, when I try to filter the list by “Plan” –> “Family” to see which users belong to the plan, I only get users who subscribed to the new one. The old one don't exist at all. And that plan doesn't show as an option to filter users by. I reached out to Stripe and they explained:

    The reason it's not populating is due to the plan being changed/updated. The filter will only return subscriptions created after the change to the plan itself, so that won't work. What you can do though, is to go through the logs of the plan itself and get the subscription ID's that way. You can then update those subscriptions.

    Which is one way. Alternately, assuming that Membership2 keeps the Stripe Plan ID metadata saved with the user, we can use that to update all the users who are on the old payment plan subscription ID and move them to the new one. So in theory, if we succeed to move the users over, this should move ALL users to this new plan.

  • Panos
    • SLS

    However, the user wasn't re-assigned to the new pricing plan.

    hmm it should. I just tested that again on my test site and it did update the Customer plan. This is happening in the sync_subscription_to_plan() method of the mu-plugin.

    In order to confirm that, you can open Customer's page in stripe (eg in test mode https://dashboard.stripe.com/test/customers/cus_THEID ) and scroll to the Subscriptions section. There click on the 3 dots button to expand the option and click on the Edit Subscription link:

    As you can see in the screenshot, other than the link to the Subscription, it shows the upcoming invoices where the price is already updated.

    Could you double check there and let us know if indeed the plan has not been updated? Also could you share admin and ftp access for the staging site? I suspect that there might be a big number of subscriptions to update and could be timing out at some point. Will need to have a closer look though to double check.

    Kind regards!

  • David @ BBS
    • Site Builder, Child of Zeus

    Hi Panos! Thanks for your reply. Unfortunately, no success. I changed the pricing again and the pricing plan got updated, but the client didn't get switched to the new pricing plan.

    There's only one user on the Orchestra Family plan that we're testing with right now, so nothing should be timing out. Once we move the scripts to the live site, we'll be moving around 30 users, so hopefully the scripts should account for being able to process that without an issue?

    I have enabled Support Access for the the staging site. I'm emailing you FTP access now.

    Thanks!

  • David @ BBS
    • Site Builder, Child of Zeus

    Panos, you're a rockstar! Thank you! Yes, this worked like a charm. New pricing plan got created and the test user got switched over to the new pricing plan. WOOHOO! :wink: Thanks for your hard work on this. Really appreciate it.

    Final question for you. Is there any way to add a popup that would ask whether the pricing change should be prorated or not? Currently looks like the request sends the change with "prorate changes" enabled. Meaning the users get prorated for any unused time. Instead we'd like the change to get applied to their next billing cycle. How can we implement that?

    Thanks!
    David

  • David @ BBS
    • Site Builder, Child of Zeus

    Great news, it seems to be working beautifully @panoskatws! Thanks a ton!!

    Having said that, I'm having a different issue. It seems like I can't get all the pricing plans to synchronize correctly with Stripe. The "Balcony Family" plan is set at $19.99, and shows correctly everywhere on our site. However Stripe shows the plan at $19.98. If I change it to any other price point, it gets updated accordingly on Stripe, but moving it back to $19.99 resets it back to $19.98 on Stripe. Seems like the plan ID in Membership2 database on our site incorrectly saved the data somehow? Or maybe the pricing plan was incorrectly created on Stipe? Cause I'm also noticing that when switching back to that $19.99 plan (which on Stripe shows as $19.98) the user doesn't get re-assigned to this plan. I thought that running &fixsub=1 would re-create the pricing plans on Stripe, but it didn't. How can we re-synchronize all the pricing plans to make sure things are all in sync?

    Thanks!
    D

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.