#gary_api
1 messages ยท Page 1 of 1 (latest)
๐ 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/1357478001989648424
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there! You can edit any part of the Invoice when it is in a draft state: https://docs.stripe.com/invoicing/overview#invoice-statuses
I think you're likely looking for the "Update an Invoice Item" endpoint: https://docs.stripe.com/api/invoiceitems/update
Oh thank you! So changing monetary values or deleting existing invoice item is possible
for recurring invoice
yes
Could you explain a little more fully what your use case is?
My team has investigated this earlier last year and found that we were not able to modify line items even in draft invoice. Maybe things have changed since then.
One sec
We are building a system that upgrades user to a higher plan if their actual profile count is larger than what their plan allows. For example, if this user is on a $100 plan (recurring), but ended up having # of profiles of a $120 plan, in the next invoice cycle, they should be on the $120 plan.
My team has investigated this earlier last year and found that we were not able to modify line items even in draft invoice.
So last year it wasn't possible. We built a less optimized system that creates two invoices: $100 for recurring invoice, and $20 invoice for the upgrade
Ideally, we want a $120 invoice (all in one invoice)
We can only check for # of profiles right before the next invoice cycle - that's why I think listening to invoice.created event is a good idea.
When invoice.updated happens, we will check # of profiles, and update the plan value (i.e. invoice item) to $120
Does this make sense?
๐ Stepping in for my teammate. Thanks for the explanation. Give me a few minutes to test this out but I think this limitation still applies
Thanks for looking into it! Really appreciate it!
Okay, that's correct. It's not possible to update the Price in this case.
Oh that's a bummer. I believe it is not specifically stated on Stripe docs
The draft Invoice has an InvoiceLineItem that has a type of subscription. This means the InvoiceLineItem was added to the Invoice as part of normal Subscription cycling (not as part of an InvoiceItem that was added manually). InvoiceLineItems of type: 'subscription' can only be partially updated: only tax_rates and discounts can be updated for these InvoiceLineItems
Do you use usage based billing?
I'm wondering if you can use thresholds for this use case: https://docs.stripe.com/billing/subscriptions/usage-based/monitor
I see. Is there a way to add an invoice item (e.g. $20) on the same invoice so this also increases the price to $120?
We haven't used usage based billing yet because our usage system is not straightforward to be migrated yet
I see. Is there a way to add an invoice item (e.g. $20) on the same invoice so this also increases the price to $120?
Yep, that's the doc you shared earlier: https://docs.stripe.com/billing/invoices/subscription?locale=en-GB#adding-draft-invoice-items
You'd create an InvoiceItem and pass along the Customer ID, Subscription ID, amount, and currency
Sounds good! Let me try this out