#whysoasync -3ds subscription upgrade

1 messages ยท Page 1 of 1 (latest)

stuck goblet
#

hey there, can you share the subscription update request you're making?

radiant tiger
#

subscriptionId: "sub_1KR0ejDmVlmqORBIrU3IZACg"

#

req_LUN4rp85QfhTGx

stuck goblet
#

That request is changing the default payment method, not the price to be used

radiant tiger
#

I'm confused about the updating with custom button to yearly.

I get the 3d secured modal when i buy monthly, because i get client secret.
How is the flow supposed to be?

I use await stripe.subscriptions.update(req.body.subscriptonId, {
cancel_at_period_end: false,
items: [
{
price: 'price_1KOUJTDmVlmqORBI1P2Ihik6',
id: 'si_L7F9PdhyW5PGME'
}
]
})

But i don't get client secret and neither the status required_action to use it to trigger mannualy the handleCardAction

#

And i remain with past_due, the yearly subscription is not active, and the user lost the monthly subscription

stuck goblet
#

Can you share that request?

radiant tiger
#

req_LUN4rp85QfhTGx

I think this is the one

#

And i get

stuck goblet
radiant tiger
#

expand to subscriptions.update?

stuck goblet
#

yep!

radiant tiger
#

Nice ! Now i get it.

So the flow should be:

  1. stripe.subscriptions.update
  2. Get the client secret
  3. Use handleCardAction on frontend with it to validate the payment
  4. Refresh
#

right?

#

If the user doens't complete the 3d secured, the subscription is now yearly, non active with status past_due and he lost all the functionalities. How can i keep the monthly subscription while he triggers that later with a button or something.

stuck goblet
#

Yep, that sounds right, though I've encourage you to test this!

The subscription shouldn't become past due immediately, was this one sitting unpaid for some time before you updated it?

#

Using that approach, the update can be applied immediately if the payment succeeds, or with the same expansion you can handle the authentication or a decline

radiant tiger
#

oh cool, thank you.

The subscription was active for monthly, and when i updated it to yearly with the price id it became past due imediatly

#

I also use webhook and i use
const subscription = await stripe.subscriptions.update( subscription_id, { default_payment_method: payment_intent.payment_method, }, );

on invoice.finalized webhook event

#

on billing_reason === 'subscription_update'

stuck goblet
#

Got it -- I see

#

I'd suggest trying what I shared with this subscription or another still on monthly in test mode to ensure it gets you the behaviour you want

radiant tiger
#

Yes, thank you for help !

stuck goblet
#

NP! Happy to help ๐Ÿ™‚

radiant tiger
#

I implemented that

#

and it works nice

#

but status in latest_invoice comes open now

stuck goblet
#

Yep, it will until its paid

radiant tiger
#

cool, i can use that string then to initiate the 3d secured modal

radiant tiger
#

can handleCardAction be initiated from the react stripe library without Elements wrapper on it?

tepid marsh
#

Hello ๐Ÿ‘‹
Taking over for synthrider here
Give me a moment to catch up

radiant tiger
#

Hello, thank you !

tepid marsh
#

AFAIK it would not be possible to call it outside the elements wrapper unless I'm missing something. Let me double check to make sure that is 100% accurate.

#

It'd most likely not work outside the elements wrapper.
You can try it out in test mode

radiant tiger
#

Yea.. i will create a modal inside Elements wrapper, it's faster. I don't even know from where to access it besides useStripe() which need to be inside Elements wrapper

radiant tiger
#

Uncaught (in promise) IntegrationError: handleCardAction: The PaymentIntent supplied does not require manual server-side confirmation. Please use confirmCardPayment instead to complete the payment.

#

hmm

tepid marsh
#

Yeah I'd definitely recommend using confirmCardPayment instead