#grz-subscription-change

1 messages · Page 1 of 1 (latest)

plush totem
#

Hello!

#

@grave cobalt yeah in that flow we need to take a payment immediately

#

What error do you get with pending_if_incomplete exactly?

#

I just tried on my end and it seems to work fine

grave cobalt
#

When payment_behavior is set to pending_if_incomplete, you can only pass supported params. items[0][deleted] is not supported.

#

How this is implemented in Checkout? Does it share the same problem?

plush totem
#

ah can you try this instead : stripe.subscriptions.update(subscriptionId, { items: [ { id: itemId, price: priceId, quantity: numberOfSeats, }, ], payment_behavior: "error_if_incomplete", billing_cycle_anchor: "now", })

#

that should switch from monthly to yearly in one call

grave cobalt
#

it works only if payment works, in case of failure, the change is not effective, and there is no payment intent ready for use

#

it means a customer is unable to pay for the upsell

plush totem
#

ah duh sorry

#

it's my code but with the right payment_behavior

#
      items: [
        {
          id: itemId,
          price: priceId,
          quantity: numberOfSeats,
        },
      ],
      payment_behavior: "pending_if_incomplete",
      billing_cycle_anchor: "now",
    })```
#

that's what I tried earlier today and it worked (you don't need billing_cycle_anchor by the way, when you go from monthly to yearly the billing cycle resets immediately)

grave cobalt
#

that's amazing help, thank you so much

#

it works now