#zlatko_customer-portal-sub-upgrade

1 messages Β· Page 1 of 1 (latest)

olive kilnBOT
#

πŸ‘‹ Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

πŸ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1333454594793017395

πŸ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

glass bramble
#

To give a bit more information.

I did a bit of an investigation and I figured out why the customer can't upgrade/downgrade in the customer portal, but I do not understand why the behavior is like this and how we can change it. To give you a bit of insight into our setup:

  • We have multiple products that represent good|better|best model
  • Each of the products has two prices. A monthly and a yearly price
  • Each of the prices follows a multi-currency model. We have USD which is tax-inclusive and CAD which is tax-exclusive.

The problem is that whenever a Canadian customer goes to the Customer Portal they only see their own subscription and can't upgrade/downgrade to another product(We already checked the setup in the Customer Portal and it is correctly set).

What I figured out is that if I go to the Stripe dashboard and update a customer's subscription and set the collect tax option to "automatic" or "disable" the upgrade/downgrade in the customer portal shows up all the possible options(This is what we want).

The problem now lies in the fact that we manually defined different tax rates and assigned these tax rates based on the customer's address through the code. When we do this it seems to break the upgrade/downgrade flow in the Customer portal.

Could you please let me know how we can make the customer portal upgrade/downgrade work while using our own custom tax rates?

#

Hopefully the above screenshots help with the issue:

  1. Unable to upgrade/downgrade when custom tax_rate is selected
  2. Able to upgrade/downgrade when automatic tax calculation is selected
  3. Able to upgrade/downgrade when automatic tax calculation is disabled
amber berryBOT
nimble idol
#

Sincere apologies for the delay. The server is pretty busy at the moment, I'll be with you as soon as I can.

#

Again, sorry about the delay. I'm trying to get my bearings here. So you're saying sometimes you see Subscriptions shown in the Customer Portal, but the option to update them isn't available?

glass bramble
#

I've seen those limitations but I think they don't apply to the above situation. The customer is trying to switch between a plan in CAD. The options get shown when automatic tax is enabled or disabled, but fail to show up when a custom tax_rate is selected

#

This is the limitation, but the tax behaviour is the same our case
Customers can only modify subscriptions if the new price has the same tax behaviour as the initial price. Additionally, no modifications are allowed if the tax behaviour is unspecified, even if the tax behaviour of the new price is unspecified. Learn more about the tax_behavior parameter and how it relates to subscriptions.

nimble idol
#

I'm not sure I understand, since automatic tax can only be enabled or disabled. Maybe I'm not grasping something?

#

What are the Prices/Products you're trying to upgrade between?

glass bramble
#

The automatic tax can be disabled/enabled, but you also allow to add manual_tax through tax_rate e.g.

const sessionPayload: Stripe.Checkout.SessionCreateParams = {
    billing_address_collection: 'auto',
    line_items: [
      {
        price: prices.data[0].id,
        quantity: 1,
        ...(taxRate ? { tax_rates: [taxRate] } : {}),
      },
    ],
    currency: organization.currency, // We need to set currency because USD is tax inclusive and CAD is tax exclusive. Using tax_rate wouldn't work if currency is not set
    mode: 'subscription',
    client_reference_id: data.orgId,
    success_url: `${DOMAIN}/${data.orgId}/settings/org/billing?success=true`, 
    cancel_url: `${DOMAIN}/${data.orgId}/settings/org?/billing`,
  };
nimble idol
#

I guess I'm not seeing how automatic tax is involved, since you say the behavior is seen whether it's enabled or disabled.

glass bramble
#

On that point your are probably correct. It might only be related to the custom tax rate that gets selected.

#

The question is then why does the taxRateinterfere with the upgrade/downgrade in Customer Portal

#

The tax behaviour is the same in all cases so that limitation should not apply to this scenario.

#

Just double-checked and the create tax_rates have Exclusive behaviour which aligns with the CAD currency behaviour which is also Exclusive

nimble idol
#

This isn't a limitation that I've heard of before, but it may exist. Do you have the ID of a Billing Portal Session where you saw this behavior that you can share?

glass bramble
#

I'm testing this locally, but give me a minute to create a live session. btw, how can I share this with you privately?

nimble idol
#

You can't, discussions here are public, so all developers integrating Stripe can learn from the conversations. If you'd like a private discussion you will need to open a support ticket for that.

glass bramble
#

I sent you the ID above in BitWarden

nimble idol
glass bramble
#

Here is a test id => bps_1Qlv7VIiJQgCcrxeilHc2Y9L

nimble idol
#

Thank you, I'll take a closer look at it in just a second.

olive kilnBOT
celest ridge
#

Hi πŸ‘‹

I'm stepping in as my colleague has to go.

#

I've been looking at your billing portal session and billing portal configuration. I think they both look like they should support modifying the subscription

glass bramble
#

HI πŸ‘‹ Thank you for taking a look. Yes, that is my impression as well, but for some reason it doesn't work when using tax_rates

celest ridge
#

Okay, so just so I am clear, if you apply custom tax rates to the Subscription Items, then you cannot edit that subscription in the billing portal? Is that what you are finding?

glass bramble
#

Exactly

#

You can see how it looks in the UI in the screenshots I posted at the start of the thread

celest ridge
#

I'm guessing the button to edit the Subscription doesn't show up in those cases

#

(Sorry the server is really busy ATM)

glass bramble
#

The button shows up and you can click on it. It just doesn't show any other Products to switch to. You can only see the current Product that you have in your Subscription

celest ridge
#

Hmmmm .... πŸ€”

That is slightly different behavior than I would expect. If the custom tax rates made the Subscription ineligible then you would not see the button (which is the issue I come across more often).

#

I'm reaching out to some colleagues to see if we can replicate the behavior.

glass bramble
#

I would not expect using tax rates to be an issue since the CAD tax behaviour is exclusive and the tax rate behaviour is exclusive and only used for CAD

#

It definitely is a bit strange behaviour

celest ridge
#

Yeah we are still working on replicating this behavior. However, we may still need you to write in to support with all the details you've shared here so we can spend more time digging into this behavior. I will let you know if that becomes necessary

glass bramble
#

Let me know if I can somehow help. The test environment has the whole setup product/price/currency/taxRate. You can create a new CAD subscription and then try to upgrade/downgrade in the customer portal and you'll encounter this behaviour

    env,
    organization.address.country,
    organization.address.state
  );

  // //////////////////////
  const sessionPayload: Stripe.Checkout.SessionCreateParams = {
    billing_address_collection: 'auto',
    line_items: [
      {
        price: prices.data[0].id,
        quantity: 1,
        ...(taxRate ? { tax_rates: [taxRate] } : {}),
      },
    ],
    currency: organization.currency, // We need to set currency because USD is tax inclusive and CAD is tax exclusive. Using tax_rate wouldn't work if currency is not set
    mode: 'subscription',
    client_reference_id: data.orgId,
    success_url: `${DOMAIN}/${data.orgId}/settings/org/billing?success=true`,
    cancel_url: `${DOMAIN}/${data.orgId}/settings/org?/billing`,
  };
celest ridge
#

Unfortunately we are not able to replicate your scenario during initial testing. I am going to send you a link to write in to Support and we can dig into this in more depth.

olive kilnBOT
#

Hello @glass bramble, we have sent you a direct message, please check it at https://discord.com/channels/@me/1333493608451670016

  • πŸ”—The message has instructions on how to open a direct support case with our Developer Support team, in order to help you more effectively.
celest ridge
#

We will be able to spend more time replicating your scenario so we can either identify what is causing this failure and respond with a fix, or, file a detailed report internally to get this issue addressed.

glass bramble
#

πŸ‘ Can I expect a communication through email or Discord

celest ridge
#

We will respond through email. Once you reach a certain level of complexity, we cannot really solve cases in real time through chat.