#ibtashamAlee-subscriptions
1 messages · Page 1 of 1 (latest)
hi! do you have some details like the subscription ID sub_xxx and details of the change you make and what APIs exactly you call and what you see directly?
Yes, I do have.
id: sub_1LVs0qB0xtofIlR8vCjgx70k
Coupon: Test-12
I apply this coupon to plan-premium. Then I used it plan-premium-yearly. It gives me a response. The discount object is null on the first hit, but on the second, it gives me a discount object. I am unable to determine its behaviour.
can you do a new test with a new subscription instead and just do the minimum number of changes to explain your quetion?
that subscription has had dozens of updates over the last 4 days so it's really hard for me to try to untangle.
ok
ultimately what you're probabably confused by us that discount is null if there's no ongoing discount
There is discount
if you create a Subscription and pass a coupon that has "one use" like "12% off once" , then that coupon is used and is applied to the first payment immediately but there is no discount on the subscription object returned since there won't be any discounts on future payments. That's probably what you see and confuses you but that's normal.
but sometimes api gives me null and sometimes it gives me object
ok, let me try again
if you update a subscription in a way that does not require a payment(like moving from one monthly plan to a more expensive monthly plan), while passing a one-time coupon, it creates a discount since the next invoice will have that coupon. if you update a subscription in a way that does require a payment(like moving from a monthly plan to a yearly plan), while passing a coupon, it does not create a discount since the one-time coupon was applied to that invoice created during the update and doesn't apply to any further invoices.
Is there any way to stop this behaviour like If I want to apply the discount on both cases? And the other thing is how to notify users that this coupon cannot be applied to this subscription as I am doing some calculations for users on the basis of discounts on my end.
like If I want to apply the discount on both cases?
I don't understand, can you elaborate?
You said that moving from one monthly plan to a yearly plan while passing coupon code doesn't create a discount. I want to know if there is any parameter I can pass along with the coupon so that it must apply to the invoice.
which invoice?
moving from a monthly plan to a yearly plan creates an invoice right now that charges for the upcoming year. (https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#immediate-payment) If you pass a one-time coupon as well, that coupon applies to that invoice. There'll be another invoice in a year that has no discount. What do you want instead?
Thank you. let me have look