#ibtashamAlee-subscriptions

1 messages · Page 1 of 1 (latest)

lofty lichen
#

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?

desert jungle
#

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.

lofty lichen
#

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.

desert jungle
#

ok

lofty lichen
#

ultimately what you're probabably confused by us that discount is null if there's no ongoing discount

desert jungle
#

There is discount

lofty lichen
#

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.

desert jungle
#

but sometimes api gives me null and sometimes it gives me object

#

ok, let me try again

lofty lichen
#

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.

desert jungle
#

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.

lofty lichen
#

like If I want to apply the discount on both cases?
I don't understand, can you elaborate?

desert jungle
lofty lichen
#

which invoice?

desert jungle
#

Thank you. let me have look