#obo_invoice-upcoming

1 messages · Page 1 of 1 (latest)

tiny turtleBOT
#

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

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

dusk echo
#

I stand corrected, the dashboard doesn't provide the ID either. I mistook the sub id for the invoice ID. My original question still stands though. How can I edit an upcoming invoice?

slender meadow
#

@dusk echo you can't, it's impossible to update an upcoming Invoice. This API is here just to preview what will be invoiced in the future

#

obo_invoice-upcoming

dusk echo
#

hmm okay so I see this language: "If you want to change the amount that your customer will be billed, you can add, remove, or update pending invoice items, or update the customer’s discount."

#

where can I add / remove / update pending invoice items

slender meadow
#

using one of those https://docs.stripe.com/api/invoiceitems
But it's specifically about InvoiceItems. Those are a special type of object and doesn't mean "every line item on an Invoice"

Taking a step back: what are you trying to do or remove exactly?

dusk echo
#

sure, great question

#

currently we have subscriptions for our users that they can move between. eventually we would like to move to stripe checkout, but the issue we have there is that we have a ton of metered billing items that are associated with our platform. Right now we're just subscribing every paid account to every single thing that can be metered on the platform, but that's getting a little messy.

What we'd like to do is just run billing for them at the end of the month (the 24 hours before bills go out) and edit their invoice to reflect whatever usage they occurred by adding relevant line items to it

#

and then billing becomes much more dynamic and we don't have to mass edit all of our paid customers subscriptions every time a new product comes out. Instead it's just another line item that can be added if the users chooses to use that product

slender meadow
#

gotcha so you don't really want to delete anything in that case. You want to change your entire modeling so that all Customers have one Subscription with one say $0/month Price and then each month you calculate usage yourself and create additional line items for the new Invoice for the right amount(s) is that correct?

dusk echo
#

essentially yeah. We do have $20 a month subs, and $100 a month subs though

#

that unlock different tiers

#

those will be constant, but everything else will be metered

slender meadow
#

Okay, so you need to update each individual Subscription to move to that one Price.

dusk echo
#

luckily all subscriptions are currently on those respective prices

slender meadow
#

I thought you said they were on every other Price? 😅

dusk echo
#

they just have a bunch of other prices they're subscribed to as well

#

here let me get an example

slender meadow
#

okay so yeah that's what I meant, you need to Update those Subscriptions to explicitly move to just that one Price and remove every other Price from it

dusk echo
#

"Metered Picnic Plan" is the monthly sub

#

yeah, I'll migrate all those subs

#

I know how to do that

#

I'm more curious how to do the other part (adding line items to upcoming invoices)

#

I know invoices have a draft state they enter, but I was hoping to be able to edit them before that point if possible

slender meadow
#

The best approach is to write a webhook handler that listens to invoice.created Event that tells you a new Invoice was issued. At that point you can write code to create the line items for that Invoice using the Create InvoiceItem API (https://docs.stripe.com/api/invoiceitems/create) and passing invoice: 'in_1234' for each line.

You can do this before the Invoice is created if you want by using the same API and those will be "pending" on the Customer until a future Invoice is created

dusk echo
#

got it

#

okay cool, that's helpful thank you

#

are invoiceItems explicitely non subscription items?

#

I just did an invoiceItems list call on that customer I provided above and noticed none of the subscribed prices were showing up there

slender meadow
#

are invoiceItems explicitely non subscription items?
correct they are completely different objects

#

They are basically "one-off invoice line items you create ad-hoc".

dusk echo
#

okay perfect

#

last question, do you know if invoice items pose any issues for 3DS / indian banking regulations?

#

I know if they go over $100 (or whatever the amount is) it becomes challenging, but I didn't know if charging something that they didn't "subscribe" to would cause issues

slender meadow
#

InvoiceItems are kind of irrelevant/orthogonal to any of this. But yes, if you change the amount you charge every month it can cause issues with for customers based in India as they will likely have to go through 3DS for some of those payments

dusk echo
#

okay that's good to know, thanks

#

appreciate the help