#daniel-subscription-invoice
1 messages ยท Page 1 of 1 (latest)
Yeah I noticed, no worries. Take your time ๐
Can you clarify which exact webhook/event you are thinking of?
I believe it would be invoice.payment_failed
Okay, can you give me a bit more details? How are you doung the quantity "adjustment"? You said "increase, naturally" but I'm not sure what that could mean.
Can you try and give me a concrete example of the flow?
A user tries to upgrade their subscription quantity by some amount, and our backend (Rails) makes a call that looks like this:
Stripe::Subscription.update(subscription_id, {quantity: new_quantity})
Okay, that does not cause an invoice to ever be sent
Sorry... the "increase, naturally" was just me trying to say "due to a quantity increase"
Hmm.
If you have a Subscription for $10/month on June 1st and then you update the quantity to 2, all we do is calculate the proration and we wait for the next invoice to invoice for the different
https://stripe.com/docs/billing/subscriptions/prorations explains this in details
Now it's possible to cut an invoice though with proration_behaviour: 'always_invoice' so maybe you do that?
Hm. Give me a moment.
Sorry, was pulled onto another task.
We charge the customer immediately, accomplishing this by creating a Stripe::InvoiceItem and then creating a Stripe::Invoice, both pointing to the subscription.
I missed this detail because I'd somehow jumped out of the feature branch ๐
...given that I'm the one creating the invoice, I imagine I can set the metadata on it myself to say "this was created for the purpose of increasing a subscription", or something like that. Correct?
accomplishing this by creating a Stripe::InvoiceItem
doesn't make sense, we do tha for you by default
but I assume you just create the invoice after the fact in that case
you could tweak this by using proration_behavior: 'always_invoice' which would do all of this in one call :p
Overall though you can use https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason which is what you were after originally, it tells you what created the Invoice
Yes, I misspoke.
We charge the customer immediately, by creating a Stripe::InvoiceItem and then creating a Stripe::Invoice, both pointing to the subscription.
proration_behavior is set to none.
I thought billing_reason only said things like "subscription_update" or "subscription_cycle"