#daniel-subscription-invoice

1 messages ยท Page 1 of 1 (latest)

carmine sequoia
#

@celest valve ๐Ÿ‘‹ let me read and catch up, the channel is a bit busy

celest valve
#

Yeah I noticed, no worries. Take your time ๐Ÿ™‚

carmine sequoia
#

Can you clarify which exact webhook/event you are thinking of?

celest valve
#

I believe it would be invoice.payment_failed

carmine sequoia
#

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?

celest valve
#

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})

carmine sequoia
#

Okay, that does not cause an invoice to ever be sent

celest valve
#

Sorry... the "increase, naturally" was just me trying to say "due to a quantity increase"

#

Hmm.

carmine sequoia
#

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

#

Now it's possible to cut an invoice though with proration_behaviour: 'always_invoice' so maybe you do that?

celest valve
#

Hm. Give me a moment.

celest valve
#

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?

carmine sequoia
#

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

celest valve
#

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"

carmine sequoia
#

I think it says something else in your case. But really you should let us do all the proration and invoicing. But you can always set metadata on invoice creation otherwise

#

I have to step away but @shut gazelle can help if you have follow up questions