#Eranga-update-subscription-coupon

1 messages Β· Page 1 of 1 (latest)

normal plaza
#

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?

crisp frigate
#

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

normal plaza
#

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?

crisp frigate
#

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? πŸ˜…

normal plaza
#

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?

crisp frigate
#

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

normal plaza
#

Yeah, I was trying to remember if always_invoice also shifted the period when it invoices, but it doesn't.

crisp frigate
#

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

normal plaza
#

That does seem to be how it is currently behaving, am working to confirm if this is expected.

crisp frigate
#

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?

normal plaza
#

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.

crisp frigate
#

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

normal plaza
#

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.

crisp frigate
normal plaza
#

If the invoice hasn't been created yet, then yes you'd use the upcoming endpoint.

crisp frigate
#

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?

normal plaza
#

Yeah, that's probably the safest route.

crisp frigate
#

Cool, thanks for all the help

#

That is all for now

#

πŸ‘Ό

normal plaza
#

Happy to help! I've got to step away so I'm going to archive this thread, but if there are more questions that arise then please drop those in #dev-help .

#

πŸ‘‹