#Alimot
1 messages · Page 1 of 1 (latest)
Hi! Let me help you with this.
What's the error that you're getting?
Maybe you could share the request ID req_...?
We are not getting any error.
but, in the update subscription response, the invoice is the invoice before coupon and it's not updating with the discount.
Even if I set proration_behavior to always_invoice
return await this.stripe.subscriptions.update(subscriptionId, {
items: [
{
id: subscriptionItems.data[0].id,
price: priceId,
},
],
payment_behavior: 'default_incomplete',
proration_behavior: 'always_invoice',
expand: ['latest_invoice.payment_intent'],
coupon: coupon,
});
Let me check that on my side.
Could you please share the subscription ID?
sub_...
I tried to reproduce on my end and the coupon was applied
I can investigate further if I get your subscription ID
This is a subId
sub_1M6zvTGyOBDbEOMCJakMCgTV
Is it only works on active (paid) subscriptions or doesn't matter?
I don't see the request with the coupon
Is this the correct subscription ID?
Yes it's correct, but of course i'm not testing in the live mode. It's on the Test mode
you can just confirming with the invoice in response. If you are getting the invoice amount + the discount code. means something is wrong on my side.
Please let me know if you check the invoice object in the response not the coupon object.
Okay, I just confirmed that the coupon is applied before the proration is calculated (e.g. basic plan $10, pro plan $20, discount -$5, proration invoice in the middle of the period = ($20 - $5) / 2 - $10 / 2 = $2.5)
I guess that's what you meant in the very beginning, correct?
How do you want it to work?
Logically that's correct. i'm not getting this ($20 - $5) on invoice. but, if you are confirming, means the problem is on my side.
I don't want to take your time more than this. That was a big help.
Thank you for your time
👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!