#lafafm-update-plan
1 messages · Page 1 of 1 (latest)
Hey there 👋 so it sounds like you're updating a plan and trying to figure out how to handle 3DS flows when you do. Does your flow have your user updating the plan through a UI, or will it be your system doing this behind the scenes?
Through the UI
Current action order is:
- customer chooses the plan
- api request to the back
- we're trying to charge pro-ration, and in case of failure - declining plan update (there's an error thrown from Stripe API, that payment isn't verified)
So you'll want to see if the payment intent goes into a requires_action state, if it does then you'll want to look at next_action to see if it's redirect_to_url. Then you'll want to redirect the user, this discussed a bit further here:
https://stripe.com/docs/payments/3d-secure
If we're using subscription.update call with prorate option set
Where the payment intent can be got?
If you retrieve the subscription, you can expand the latest_invoice field to see the payment intent. You can also recursively expand the payment_intentto retrieve it's details in the same call.
E.g. before updating subscription plan - we should get latest paid invoice from that subscription, and verify it's payment intent?
Or it should be done after subscription update returned an error already?
You're wanting to check if the payment fails when you update the subscription, right?
I want to make subscription upgradable for any card
So if error occurs - handle / verify or prevent it by verifying before
Sorry, my thoughts were getting a little off track. You'll want to do the upgrade, and then check the most recent payment intent.
Can I generate a PaymentIntent before the subscription update somehow?
E.g. if I'd know the final amount of payment - can I create PaymentIntent, verify it, and then pass to subscription update call?
You could, if you determine the prorated amount and create a payment for it, and then update the subscription with proration disabled. But the payment you created won't be associated with the subscription in any way.