#t90
1 messages · Page 1 of 1 (latest)
Interesting, looking in to this. Did you apply some discount to this subscription when it was created? I don't think it would need to be reapplied if it was still in effect but will have to double check
Yes, the discount was applied by the customer through the checkout.
Also I see that the price itself has "(20% Discount)" in its name. Is the price already discounted?
That's just the name.
Subsequently when the user adds a new seat and we update the subscription quantity, the invoice gets regenerated but without the original discount applied.
We asked tech support about this and they said we need to send the discount with the subscription update request but there is no parameter for it.
Oh I see, that coupon was set to only apply once https://dashboard.stripe.com/logs/req_pEWP6viexKDPSj
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
You are right that that subscription item update call doesn't have a parameter for promotion codes. I think you would need to shift to using the subscription update call and apply a discount when making that call. One moment as I find the docs
Basically you would make an update call and include the coupon that you want in the coupon parameter.
https://stripe.com/docs/api/subscriptions/update#update_subscription-coupon
You can do that call, and then your subscription item update call, though you can also update subscription items when adding the coupon as well. You would just include one subscription items that you want to update in the items array and make sure to specify the ID of the specific item you want to modify
https://stripe.com/docs/api/subscriptions/update#update_subscription-items-id
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ah okay cool, so we're currently using the subscriptionItems call.
When the subscription is created, we need to save the coupon code (not the discount ID?).
Instead of using the subscriptionItems.update call to update the quantity we use the subscriptions.update call
return this.stripe.subscriptions.update(subscriptionId, { proration_behavior: interval === 'month' ? 'create_prorations' : 'always_invoice', coupon: couponId, items: [{ id: subscriptionItemId, quantity: users.length, }] });
Does that look correct
Yes that code looks correct from what I can see here. If you run it in test mode it should change the subscription properly