How to successfully launch customer billing portal without launch errors?

Post author
Joel Vinay

Hi, I've been trying to launch customer billing portal. But, I keep getting this error which doesn't make sense to me.

{
"code": "cannot-change-team-account",
"message": "You need to remove team members before downgrading."
}

I've just passed on of my planId into the useCutomerPortal react hook. Can someones please help me with this?

Comments

5 comments

  • Comment author
    Raquel Lopez

    Looks like your user has a team account and you’re passing an id to replace the team account. And you need to remove the team members assigned to the plan before changing the plan.

    0
  • Comment author
    Joel Vinay

    Hi Raquel Lopez I'm trying to achieve this functionality.

    https://docs.memberstack.com/hc/en-us/articles/7782712032539-Stripe-Customer-Portal#h_understanding_the_integration

    Can you please help me how to achieve this using memberstack package ?

    API also helps

    0
  • Comment author
    Raquel Lopez

    The react hooks are just a wrapper of the dom library. You can read about the method you're using of the dom library and you can see what parameter and response it should expect https://developers.memberstack.com/docs/dom-front-end-package#launch-stripe-customer-billing-portal

    0
  • Comment author
    Joel Vinay

    Been trying several things but I think memberstack doesn't cater the "Cancel subscription" part. I don't understand how an important part be left out from the support.

    The function that you've guided me was available in the package but that is not what I'm looking for. The link I shared generates a 30 min live link to stripe dashboard where I can update my card or cancel my subscription.

    It would be really important memberstack adds support to atleast cancel subscription

    0
  • Comment author
    Raquel Lopez

    You can allow users to cancel their plans by passing a parameter to the method to instead of upgrading the membership, it will remove it. It's based on the Stripe configuration object

    You can try this to see if it works for you

    await memberstack.launchStripeCustomerPortal({
      // Optional parameters:
      priceIds: ["PRICE_ID_1", "PRICE_ID_2"], // Filter the portal to specific prices
      configuration: {
       subscription_cancel: {
           enabled: true
        }
      },
    });
    

    The launchStripeCustomerPortal method allows only to downgrade plans or to upgrade plans, you can't do both on the same method execution.

    Josh Lopez In the current documentation, is not covering the scenarios (or the direct link to the configuration object) that covers the actions the launchStripeCustomerPortal can do like upgrade plan, downgrade plan, update payment methods and seeing payment history. I think it would be helpful to have some reference to it. Just a suggestion.

    0

Please sign in to leave a comment.