#igna_paymentintent-capture

1 messages ¡ Page 1 of 1 (latest)

mortal nymphBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1275929593550868614

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

storm pecan
tidal maple
#

I see

#

and since using Payment Elements in the frontend is what gives me the information of the credit card, I should not really have an endpoint receiving that data and capturing the intent

#

I should create the intent with other strategy, automatic for example

storm pecan
#

I mean, you can absolutely do an auth and capture payments flow with Payment Element, you just can't do the capture step on the front-end. You would confirm on the front-end, then grab the Payment Intent ID and make a call to Capture Payment Intent API on the back-end

tidal maple
#

but I cannot confirm the payment in the frontend

storm pecan
#

That's because that Payment Intent was already confirmed. It just needs to be captured now

tidal maple
#

yeah but we created it being captured, and now we're getting the CC data in the frontend

#

I understand that's actually incorrect

storm pecan
#

I'm not sure what you mean. Did you figure it out? Or is there another question here?

tidal maple
#

I mean that we initially create the Payment Intent with:
amount
currency
payment_method_types[]=card
payment_method_options[card][capture_method]=manual
confirm=true
payment_method=pm_card_visa

#

and now we use the secret of that Intent in the frontend + Payment Elements to collect the CC data

#

What I'm understanding is that is wrong

storm pecan
#

No, so what that does is automatically confirm the Payment Intent without capturing it. So if you want to confirm the Payment Intent immediately, but not actually capture the funds until later, then this is the right path

tidal maple
#

Hmm then how do we capture the funds now if we cannot do it in the frontend and my thinking is that we shouldn't send CC data through an API (to our own backend endpoint I mean) assuming that we can get the CC data from the Payment Element

mortal nymphBOT
storm pecan
#

No. You don't want to send CC data to your back-end. That violates PCI compliance. Raw PANs and PII should never touch your server. Rather you should confirm that Payment Intent on the front-end and listen for the payment_intent.requires_action webhook event (https://docs.stripe.com/api/events/types#event_types-payment_intent.amount_capturable_updated) on your server, and then capture the payment using the Payment Intent ID from that webhook event on your back-end.

You could also just cache the ID from the Payment Intent when you create it and then check to see if it needs capture at some point later on, but if something goes wrong during confirmation, you'd need to make sure your system knew that as well, so I'd recommend webhooks over this approach

tidal maple
#

Webhooks makes complete sense here, for sure.

I'm wondering if what we're doing actually makes sense. How is it different from just creating the intent with confirm=false and capture_method=automatic_async, considering we want to charge the user immediately after they enter the CC data in the Payment Elemenet

sharp vapor
#

igna_paymentintent-capture

tidal maple
sharp vapor
#

@tidal maple yeah if you "capture the funds immediately" then there's no reason to use manual capture I think

tidal maple
#

That makes sense, thank you.
And just for my own understanding, if we were to follow a strategy like the one two-shoes mentioned, the confirm flag should be set to false when creating the Intent, right?

sharp vapor
#

yes though it's the default so you don't need to pass the parameter at all

tidal maple
#

Got it. Thanks so much guys