#Eranga-update-subscription-coupon
1 messages Β· Page 1 of 1 (latest)
Hey there π interesting question, and I'm not sure off the top of my head. When you updated the subscription did you pass any value for the proration_behavior parameter?
I didn't update the subscription per say
I queried the upcoming invoice
When I query it using always_invoice I get 0 as the discount amount
When I query using create_prorations, I get a discount amount. But that discount amount belongs to the next billing cycle's invoice line item
So creating prorations do usually occur on the next billing period, but if you always_invoice then that should happen immediately. Have you tried doing the update on a test subscription to see if it behaves the way you want?
I didn't try to update
In our system we are supposed to always_invoice
So I guessed since upcoming invoice did not send me any discount, it should be the same if I update it as well
Let me try to update a test subscription as well. But if it was different than upcoming invoice, then something is wrong, right? π
Let me double check something real quick.
When you check the upcoming invoice using always_invoice as your proration behavior, does the billing cycle anchor change?
Let me check
Upcoming invoice does not have a billing cycle anchor, right?
Since I am not changing the billing interval, I always get the same date on the month for the next billing date
If that is what you're asking
I updated the subscription using always_invoice and it doesn't have any reduction, new invoice or so for this billing cycle
But the next invoice is properly updated with the coupon
Yeah, I was trying to remember if always_invoice also shifted the period when it invoices, but it doesn't.
So, the behavior I mentioned first is expected, right? π
The discount will not be applied in this cycle, but from the next billing cycle onwards
That does seem to be how it is currently behaving, am working to confirm if this is expected.
Cool, thanks. βΊοΈ I have another question.
If I update the subscription multiple times in the billing cycle, there will be a lot of items in upcoming invoice line items, right? Sometime, I might have to paginate and retrieve the line items of an upcoming invoice, right?
Thanks for your patience, I was able to confirm that it is expected for coupons to not trigger an invoice/proration by themselves. If they were coupled with a change in price/quantity/items then that would be different.
What would be the difference if I combine it with quantity?
And I assume by quantity we mean the number of quantity the customer pays, right
Yeah, the quantity of the items on the subscription. Changes that edit the items of a subscription, when proration behavior is set to always_invoice will trigger an invoice when they're made.
It is possible to end up with enough items on an invoice to need to make multiple requests to retrieve them all (though not common), in which case you'd need to use this endpoint to retrieve them all.
https://stripe.com/docs/api/invoiceitems/list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Since I need the line items of the upcoming invoice, it would be this, right?
https://stripe.com/docs/api/invoices/upcoming_invoice_lines
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
If the invoice hasn't been created yet, then yes you'd use the upcoming endpoint.
BTW, even if I combine a coupon code and change the quantity, it won't add the discount to the newly added quantuty as well
Is it safe to think that adding coupon will not impact or not reduce any amount in this billing cycle?
Yeah, that's probably the safest route.