#vpmragu - subscription

1 messages · Page 1 of 1 (latest)

cinder blade
#

Hi there! Can you try to summarize your question in this new thread?

tribal bison
#

Hi Soma.. we are are trying to update the subscription and it is working fine. But the taxrate details are not updated in the latest_invoice.

#

we would like to know the ways to update these details.

cinder blade
#

Can you share the subscription ID?

tribal bison
#

already there the thread

#

sub_1LQ3R3KhQvshw5gFjVisrrCv

cinder blade
#

So if I understand correctly:

  • you updated the price of the subscription here: req_tsa9ZLpDogToMI to use price_1LPO1hKhQvshw5gFFfEHETNU
  • but when looking at the latest invoice of the subscription (in_1LQ3R3KhQvshw5gFlcZUHeM7), you don't see this new price?
tribal bison
#

yes

cinder blade
#

The invoice was created on 2022-07-27 at 06:09:33 UTC
Then you updated the price of the subscription on 2022-07-27 at 06:10:09 UTC
So since you made the update to the subscription after the invoice was created, it's expected that the invoice still has the old price.

tribal bison
#

but it is there in upcoming invoice details

cinder blade
#

And yes, the upcoming invoice should have the new price.

tribal bison
#

since the invoice is in draft status, why it is not getting updated in the latest_invoice?

cinder blade
#

That's not how it works. Updating a subscription will only impact invoice that will be created in the future. Invoice already created, even in draft status, won't change.

tribal bison
#

ohh, What should we do in this case? What is your recommendation? we want to send the updated invoice only to our users.

cinder blade
#

The simplest option is to update the subscription before the new invoice is created. Otherwise you can try to update the invoice while it's still in draft.

tribal bison
#

whenever we are creating a subscription, invoice will get generated and it will be in draft state, right?

#

in my case also it is still draft state only.

#

see this image

cinder blade
#

For subscriptions with collection_method: "send_invoice", then all invoices will be created in draft.

#

Can you give more context on what you are trying to do exactly?

tribal bison
#

I have a one product which offers 2 different tier (basic, premium) and in each tier we have monthly and yearly plan... So for that i created one product in stripe and 4 different prices (2 price for each tier) in stripe.. As similar to this https://stripe.com/docs/products-prices/pricing-models#flat-rate
I have shown all the 4 plan to user and user selected one plan and came to checkout page where i will create subscription (with automatic_tax: true) for that selected one and display the amount and tax split up... Now user have option to switch to the different plan, so when user choose the different plan i am updating the subscription with new selected plan's prcieId and getting new amount and tax details that i will display that to user... Now the problem is when user choose the plan which has different term (monthly plan to yearly or vice-versa within same tier or different tier) the subscription update returning proper amount and tax details.. But when user selects the same term in another tier, subscription update not returning updated value.. For example user initially selected basic monthly plan but now in checkout user trying to switch to premium monthly plan Though i am updating subscription with new priceId, it still return the old amount and tax details in the latest invoice.. The latest invoice object in the subscription not getting updated ...

Learn about common pricing models and how to model them with products and prices.

sage rune
#

can you share a specific example? Like the Invoice ID in_xxx that you say has the old or wrong details.

tribal bison
#

refer this subscription sub_1LQ3R3KhQvshw5gFjVisrrCv which has latest and upcoming invoice details

sage rune
#

That's just the original invoice

#

the problem is you assume that when you update the subscription to change the plan, it will always generate a new invoice, correct? But that's not the case.

#

so basically you updated, you looked at latest_invoice , but since there's no new invoice for this sort of update (monthly plan => a different month a plan), that hasn't changed and is still the first invoice.

tribal bison
#

No, my assumption is it will get updated in the latest_invoice. but it is not

#

so what is your recommendation to achieve this usecase?

sage rune
tribal bison
#

yes, we want to change from one monthly plan to another

#

but both plans come with different feature set

#

so different priceId and charges

sage rune
#

can you answer the specific questions I asked?

#

when doing the update, you'd like charge an amount? What amount? after that is charged, when do you want to charge them again?

#

I ask because what you want is likely very possible and simple, but I need to know what your desired outcome is exactly so I can give you the correct advice.

tribal bison
#

before it charged we are updating the subscription

#

basically in the checkout flow, user chose one plan and created the subscription. before the first payment of that subscription, user changed the plan. here we are updating the subscription.

#

so we want to have the payment details as per latest selection

#

but the latest_invoice has previously selected plan's payment details

sage rune
#

I'm really sorry but we're not communicating

sage rune
#

let's take an example

#
  • you start a subscription on monthly plan $50/month on July 1
  • 2 days later, you update to monthly plan $100/month on July 3
  • would you like the customer to be charged at this time? <--- answer this please
  • if so, what amount should they be charged? <--- answer this please
  • when is the next date after this that the customer the customer should be charged, and for how much? <--- answer this please
sage rune
# tribal bison No, my assumption is it will get updated in the `latest_invoice`. but it is not

like , the details on the actual invoice will not ever change. They're frozen. Just because you change the subscription later, that invoice will not change. A new invoice might be generated when you change the subscription depending on how you perform the update exactly(which is what I'm trying to ask you about to understand), but the actual paid invoices themselves don't ever change.

tribal bison
#

let me explain:

  • choose a monthly plan $10, calculated the tax and created a subscription - didn't pay for that subscription
  • in the same checkout flow, chose another monthly plan which costs $20 and want to update this amount into the subscription.
  • updated it with latest priceId and calculated the tax(via automatic_tax)
  • subscription got updated but not the invoice. here only i am paying for the initial subscription fee
#

in any step, i haven't completed the payment. and still subscription state is not active

sage rune
#

that doesn't make sense, you would create a new Subscription in that case, you wouldn't update the new one

tribal bison
#

so, your recommendation is always create a new subscription even a tier change?

sage rune
#

that's my advice! if the user picks a different plan, create a different subscription!

sage rune
tribal bison
#

But i need to show the tax details in the checkout page. without creating subscription, how to calculate the tax?

tribal bison
#

okay. I can use the details from upcoming invoice. then what is the status of the latest_invoice.

#

since i am using { paid_out_of_band: true } for payment complete, which invoice to update for payment complete?

#

await stripe.invoices.pay(subscription.latest_invoice, { paid_out_of_band: true });

sage rune
sage rune
tranquil moon
#

👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

tribal bison
#

is there any way to calculate tax automatically without creating subscription?

tranquil moon
#

I believe you can calculate the tax by using the upcoming invoice API with the automatic_tax field

tribal bison
#

okay, let me go through the upcoming invoice API doc.

tranquil moon
#

sure 🙂

#

let me know if you need any more help