#stellarloony-sub-coupon-update
1 messages · Page 1 of 1 (latest)
customer upgrades/downgrades from one plan to another, and we have different discounts for different plan
Can you share the API call you're making yo update the sub?
const updatedSubscription = await stripe.subscriptions.update( subscription_id, { proration_behavior: 'always_invoice', payment_behavior: 'pending_if_incomplete', items: updatedItemList, add_invoice_items: additionalItems, expand: ['latest_invoice.payment_intent'], coupon: newCoupon //this causes error } );
error: stack: StripeInvalidRequestError: When 'payment_behavior' is set to 'pending_if_incomplete', you can only pass supported params. 'coupon' is not supported.
updatedItemList: [{ id: item.id, price: SeatPrice.id, quantity: numberOfSeats}]
updatedItemList can have 2-3 objects
Yep, you'll need to use pending_updates to apply the coupon: https://stripe.com/docs/billing/subscriptions/pending-updates
pending_updates is what happens when payment_behaviour is set to pending_if_incomplete
isn't it??
Yep
So the pending updates won't apply if the payment fails. The default behaviour is for them to apply anyway
That's what I am doing, but can't change the coupon
I guess you can't apply a coupon in that instance then
any workarounds?
I guess you'd apply the coupon change in a separate update call where you don't pass payment_behavior: 'pending_if_incomplete',