#igna_paymentintent-capture
1 messages ¡ Page 1 of 1 (latest)
đ 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.
You can only capture via the back-end using this endpoint: https://docs.stripe.com/api/payment_intents/capture
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
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
That's because that Payment Intent was already confirmed. It just needs to be captured now
yeah but we created it being captured, and now we're getting the CC data in the frontend
I understand that's actually incorrect
I'm not sure what you mean. Did you figure it out? Or is there another question here?
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
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
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
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
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
igna_paymentintent-capture
https://docs.stripe.com/payments/payment-intents
Wondering if following this tutorial step by step as-is is enough for the use case
@tidal maple yeah if you "capture the funds immediately" then there's no reason to use manual capture I think
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?
yes though it's the default so you don't need to pass the parameter at all
Got it. Thanks so much guys