invoice.created webhook and changing subscription quantities

55 views
Skip to first unread message

xylude xaalud

unread,
Jul 3, 2017, 8:50:07 AM7/3/17
to Stripe API Discussion
I have a question regarding the invoice.created webhook. We want to change a customer's quantity based on usage of our tool - if we were to change it in response to the invoice.created webhook would that affect the invoice that is about to be charged to the customer, or would it only apply to the next invoices?

Zach Wick

unread,
Jul 3, 2017, 9:30:12 AM7/3/17
to api-d...@lists.stripe.com
Hi there,
I'm happy to answer your question and help you out.

I assume that when you write "change a customer's quantity" you mean update the `quantity` parameter on the `Subscription` object.

When you receive an `invoice.created` Event, if you update the `Subscription` object's `quantity`, that new value will not be reflected in the `Invoice` that was just created. Instead, this new `quantity` will be reflected in the `Invoice` that will be created for the next billing cycle.

The only way to modify the `Invoice` that was just created is to use `InvoiceItem` objects and ensuring that you pass in the `id` of the newly created `Invoice` as the `invoice` parameter as outlined in our docs [0].

I hope this clarifies the issue but please do not hesitate to get back to me if you need more details.

Good luck and happy hacking!
-zach


On Mon, Jul 3, 2017 at 8:26 AM, xylude xaalud <xyl...@gmail.com> wrote:
I have a question regarding the invoice.created webhook. We want to change a customer's quantity based on usage of our tool - if we were to change it in response to the invoice.created webhook would that affect the invoice that is about to be charged to the customer, or would it only apply to the next invoices?

--
You received this message because you are subscribed to the Google Groups "Stripe API Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss+unsubscribe@lists.stripe.com.
To post to this group, send email to api-d...@lists.stripe.com.
Visit this group at https://groups.google.com/a/lists.stripe.com/group/api-discuss/.

Reply all
Reply to author
Forward
0 new messages