#Eranga

1 messages ยท Page 1 of 1 (latest)

lament idolBOT
astral silo
#

Hi there, if the coupon's duration is set to once, it can only be applied once for the first charge (i.e., first invoice), and it's not applied in the subsequent invoices (i.e., the preview invoice with new quantity)

sturdy pivot
#

Yes, that is true. From the customer's end, the amount we ask to pay is not fair. Because if they did not change the quantity, they would enjoy the discount for the entire billing cycle. But if they increase the quantity, this would remove the discount from the already paid quantity as well

astral silo
#

I don't think the discount is removed from the already paid item. What you are previewing is the invoice from next billing cycle, where the discount is no longer applied.

sturdy pivot
#

Since I am setting the proration behavior to always invoice, I am previewing the amount the user is supposed to pay now. And since the price is the same, it will show me how much the customer needs to pay for the existing billing cycle, if the change is to happen, right?

astral silo
#

Ah, you are setting proration behaviour to always_invoice

sturdy pivot
#

Yeah, we have a bit of weird use case which needs to ask the user to pay at the same billing cycle multiple times if they increase something

astral silo
#

Then it'll be prorated but without the discount because the coupon is already applied once.

sturdy pivot
#

Yeah, the invoice is prorated. But I can see that the amount we ask the user is
10 new quantity (no discount applied, prorated from now) + 10 old quantity (the applied discount is removed, prorated from now)

#

It would be okay to remove the discount from the new quantity, but the old quantity should retain the discount, right?

astral silo
#

The current subscription engine will produce the following invoice items

  1. Unused time on the original 10x quantity (-)
  2. Remaining time on the new 20x quantity (+)
  3. The 20x quantity for the next billing cycle (+)
#

I believe the misalignment is on the last item ( The 20x quantity for the next billing cycle), you are expecting 10 of them should still be discounted, am I right

sturdy pivot
#

Give me a sec to process ๐Ÿ˜„

#

Since my proration behavior is always_invoice I would only get 2 invoice items, right? The 1st and the 2nd in your list

#

My problem is with the 2nd item having no discount.

#

I would say in the 2nd item:

  • we should either provide the discount to all 20 items,
  • or we should give the discount to 10 items and the other 10 without discount
astral silo
#

Ah, yes I missed the always_invoice again.

#

The current subscription engine treats the new 20x quantity as a whole, so it won't apply discount for 10 of them.

#

The workaround here is to set another once coupon when updating the subscription.

sturdy pivot
#

Yes, that is what I am thinking as well. So now I need to know if my current subscription has a one-time discount applied. How can I know that programmatically?

astral silo
sturdy pivot
#

That is null in this case

astral silo
#

Hmm, that's because the coupon is already applied.

sturdy pivot
#

Yes, so when the coupon is applied I can see the discount is being created -> the invoice is also created -> invoice is paid -> the discount is deleted

astral silo
sturdy pivot
#

Cool, I thought there might be an out of the box way in Stripe for this though

#

No problem, this helps ๐ŸŽ‰

#

Thank you for your time @astral silo

#

That is all for now. Have a nice day ๐Ÿฅ‚