#whysoasync -3ds subscription upgrade
1 messages ยท Page 1 of 1 (latest)
hey there, can you share the subscription update request you're making?
eg req_1234 (see https://stripe.com/docs/api/request_ids )
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
That request is changing the default payment method, not the price to be used
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
Can you share that request?
The client secret is on the payment intent in the invoice -- you need to use expansion to get that.
https://stripe.com/docs/api/expanding_objects
eg: add expand: ['latest_invoice.payment_intent'] to your request
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
expand to subscriptions.update?
yep!
Nice ! Now i get it.
So the flow should be:
- stripe.subscriptions.update
- Get the client secret
- Use handleCardAction on frontend with it to validate the payment
- 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.
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?
But, we have a flow that allows you to hold updates as pending in case of payment problems, see here: https://stripe.com/docs/billing/subscriptions/pending-updates#update-subscription
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
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'
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
Yes, thank you for help !
NP! Happy to help ๐
I implemented that
and it works nice
but status in latest_invoice comes open now
Yep, it will until its paid
cool, i can use that string then to initiate the 3d secured modal
can handleCardAction be initiated from the react stripe library without Elements wrapper on it?
Hello ๐
Taking over for synthrider here
Give me a moment to catch up
Hello, thank you !
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
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
Uncaught (in promise) IntegrationError: handleCardAction: The PaymentIntent supplied does not require manual server-side confirmation. Please use confirmCardPayment instead to complete the payment.
hmm
Yeah I'd definitely recommend using confirmCardPayment instead