#dejwsiu

1 messages ยท Page 1 of 1 (latest)

heavy sentinelBOT
barren smelt
#

๐Ÿ‘‹ happy to help

#

while updating subscription via payment intents API
would you mind elaborating more?

midnight holly
#

nestjs/angular implementation:

  1. i use stripe.subscription.update method
  2. i check the response for indicators that payment requires actions (3ds auth process)
  3. 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)
  4. 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

barren smelt
#

we will take care of the rest

midnight holly
#

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?

barren smelt
#

is the collection_method "charge automatically"?

midnight holly
#

these are my sub update call params

#

(update is used only to change quantity of volume pricing based product. nothing else changes here)

barren smelt
#

when you created the Subscription what was the collection_method?

midnight holly
#

seems default. cuz im using Checkout session for creating new subscriptions, and im not passing any value for this parameter

barren smelt
#

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

midnight holly
#

hmm.. confirmCardPayment is part of API or stripe.js?

#

im not using stripe.js at all at front for the moment

barren smelt
#

stripe.js

midnight holly
#

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

barren smelt
#

I don't know of any other way to achieve what you're looking for other than the recommendation I gave you

midnight holly
#

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?

midnight holly
#

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

barren smelt
#

that's correct

midnight holly
#

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

barren smelt
#

sure thing

#

or something like { status: success|requires_action, client_secret}

#

so you can use the payment_intent status and client_secret fields

midnight holly
#

great. thank you for explaining

#

have a good they then, hope i will manage this ๐Ÿ™‚