#dejwsiu
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
while updating subscription via payment intents API
would you mind elaborating more?
nestjs/angular implementation:
- i use stripe.subscription.update method
- i check the response for indicators that payment requires actions (3ds auth process)
- i take blank URL as a string, for 3ds auth redirect from 1. response (res.latest_invoice.payment_intent.next_action.use_stripe_sdk.stripe_js)
- i use this URL on frontend to simply redirect user from my app to 3ds auth process (simply by using window.location.href method)
can i add a parameter (or set it somewhere on stripe portal) to redirect back user to my app. cuz authorization finish on screen with information that user can close this window
and give no option to go back anywhere
maybe instead i should use this URL in modal?
i'm not sure how real-life examples of 3ds cards may appear, i only know how stripe test cards appear for this case
you just need to call https://stripe.com/docs/js/payment_intents/confirm_card_payment with the client_secret from latest_invoice.payment_intent and you can add the return_url https://stripe.com/docs/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-data-return_url
we will take care of the rest
ok so what would be the step after i get response from stripe.subscription.update? typically i send response object to frontend and decide either end payment flow or move to 3ds auth url
so maybe we start from momant when i get response from 'update'. what's next?
is the collection_method "charge automatically"?
these are my sub update call params
(update is used only to change quantity of volume pricing based product. nothing else changes here)
when you created the Subscription what was the collection_method?
seems default. cuz im using Checkout session for creating new subscriptions, and im not passing any value for this parameter
ok perfect
then what I would do is the following
I would only expand on latest_invoice.payment_intent
check its status
if it's requires_action
then I would send the front-end its client_secret and use confirmCardPayment to deal with 3DS
hmm.. confirmCardPayment is part of API or stripe.js?
im not using stripe.js at all at front for the moment
stripe.js
ok, dont wanna strain your patience but to save time - do i have to somehow re-arange existing process on front or add anything else, since i have totally custom collection of data on frontend for sub update and im only passing this data to backend to process this
so no stripe.js implementation is included anywhere in my app
I don't know of any other way to achieve what you're looking for other than the recommendation I gave you
ok i understand
but may i use stripe.js only for this action or i have to reimplement anything more in the frontend?
for the moment i have my "own" button that's just use service in the frontend to send data to backend (sub update) and waits for response
do i need anything more than handling response with stripe.js?
you can use it only here
ok - so to summarize
i wait on backend for response. i build logic on it to 1. check if payment was succesfull or 2. it requires_action
if 1. is true i send to front 'true' or whatever i need to confirm this, if 2. i send client_secret
then on frontend i build logic around those two circumstances and either end payment flow, either trigger confirmCardPayment
that's correct
and probably would be good to wrap this on backend with some custom type object like { success: boolean, requires_action: boolean, client_secret: string/null }
to transfer always same type and stay with core logic based on full response object on backend