#stellarloony-sub-coupon-update

1 messages · Page 1 of 1 (latest)

noble dagger
#

Hey! You can't, I don't think. What's the use case?

queen heron
#

customer upgrades/downgrades from one plan to another, and we have different discounts for different plan

noble dagger
#

Can you share the API call you're making yo update the sub?

queen heron
#

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 } );

noble dagger
#

What's the error?

#

And can you share your updatedItemList variable

queen heron
#

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

noble dagger
queen heron
#

pending_updates is what happens when payment_behaviour is set to pending_if_incomplete

#

isn't it??

noble dagger
#

Yep

#

So the pending updates won't apply if the payment fails. The default behaviour is for them to apply anyway

queen heron
#

That's what I am doing, but can't change the coupon

noble dagger
#

I guess you can't apply a coupon in that instance then

queen heron
#

any workarounds?

noble dagger
#

I guess you'd apply the coupon change in a separate update call where you don't pass payment_behavior: 'pending_if_incomplete',