#kamal-singh_api

1 messages · Page 1 of 1 (latest)

tough oarBOT
#

👋 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/1346792592930504794

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

native marten
#

hi there!

flint geode
#

req_5NTQz6WzKoqvpr

native marten
#

the error message is pretty clear: you can't change the price itself

flint geode
#

so what can i do to update the price?

native marten
#

you can't. but you could add a new line item to the Invoice.

#

can you explain in more detail what is your use case?

flint geode
#

i want to update the invoice if there is any change in price with a new price id whenever our server receive invoice.created event

native marten
#

I don't really understand. but like mentioned above, you can't change the price itself, but you coudl add a new price to the invoice if needeD.

flint geode
native marten
#

but how was your invoice created? by a subscription?

flint geode
native marten
#

then yes, you can't update the price

flint geode
#

When a customer is charged in a subscription cycle, but what if we've updated price for a subscription so we are fetching the subscription from our DB and if there is updated price then on every invoice.created webhook, we want to update the price.

#

on invoice.created event we checks if there is any updated price from our DB and if its there, then we want to update the invoice with the new price

native marten
#

but what if we've updated price for a subscription so we are fetching the subscription from our DB and if there is updated price then on every invoice.created webhook, we want to update the price.
I don't understand. can you explain, step-by-step, with a concrete example?

tough oarBOT
flint geode
#

For example, let’s say we are currently charging $10 per subscription cycle. If we decide to increase the amount to $15 starting from the next cycle, we want to make sure that the next invoice reflects the updated amount instead of the old $10 charge.

To achieve this, whenever we update the subscription price, we create a new price object with the new amount (to maintain reference to previous price). When Stripe generates the next invoice for the upcoming subscription cycle, we update the subscription to use the new price, ensuring the customer is charged the correct, updated amount.

pliant hamlet
#

You'd need to update the subscription to the new price before the next billing cycle invoice

#

You're doing it the wrong way

#

Is this a user chosen upgrade, or are you just increasing the subscription price?

flint geode
pliant hamlet
#

But you shouldn't wait for the subscription to transition into a new period, generate the invoice and then update the sub

flint geode
#

ok . got it

#

so does this method allows us to update all subscription with a price id?

pliant hamlet
#

Yes, you'd 'schedule' the upgrade to occur at the end of a phase (i.e. current period)

flint geode
#

ok