#lunarexhale_code
1 messages ¡ Page 1 of 1 (latest)
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- lunarexhale_invoice-receipt-emails, 18 hours ago, 8 messages
đ 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/1239980342455042188
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
You're looking at the server-side method instead of the Stripe JS method: https://docs.stripe.com/js/payment_intents/confirm_payment
There are 2 different ways to confirm a Payment Intent. The one you found is for server-side confirmation calls, whereas the one I posted is for client-side confirmation calls. The client-side one is the one you want if you're passing in an Elements instance
yes, but in the docs for the client side method, it says the following for the confirmParams parameter: "Parameters that will be passed on to the Stripe API. Refer to the Payment Intents API for a full list of parameters."
that seems to suggest that it supports all the params of the rest api
so i'm not entirely sure if that actually is the case, or if only the ones defined in the typescript type definitions are supported
Where do you see that verbiage?
oh sorry, here's the link to the param https://docs.stripe.com/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams
I think the intent was to mention that the parameters included in the client-side Stripe JS docs are also documented further in the server-side docs. Not all the options in the server-side docs are allowed in the client-side method. If you look at individual parameters in the client-side docs, you'll see references to the same specific parameters in the server-side docs. Those are the ones that are usable.
That being said, yeah. The verbiage is really confusing
ah okay, gotcha
does that mean there isn't a way to use manual capture_method with stripe js?
my initial intent was to basically set capture_method to manual when confirming the payment intent from the client side, and then manually capture the funds on the backend later
Right, you could still do that, but you would need to create the payment Intent ahead of time and pass in capture_method: "manual" during creation.
Then pass that Payment Intent into the Payment Element and call stripe.confirmPayment()
ahhh okay, i totally missed that param in the creation api docs
do you have a general rule of thumb for when to capture manually vs automatically? or is that pretty difficult to say without a specific example?
as a separate but related question
There's no standard path. It all depends on what you want the payment flow to look like
Manual capture is more configurable, but requires more work/code from you. Automatic capture is easier to use and more instantaneous, but less configurable
Gotcha, that's helpful. Sorry, one final question - when capturing funds, if that returns a success, can it be assumed that the payment method has been charged at that point, or would we need to listen for a webhook event?
Does automatic capture basically do what manual capture does except immediately vs me having to manually call capture?
For the most part, yes
You would still need to capture the payment via this method if confirmation is successful: 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.
But yes, you would also want to check the return value from stripe.confirmPayment() to see what the outcome was and potentially perform additional actions from there
okay, and once that call succeeds, would it then be safe to assume that the charge went through?
i guess assuming next_action was null?
specifically, in our case, we're accepting cc and ach payments only
I would read through the quickstart guide here about recommended handling on-submit and during post-payment if you haven't already: https://docs.stripe.com/payments/quickstart#submit-event
Pay special attention to step 4:
Stripe recommends handling the payment_intent.succeeded, payment_intent.processing, and payment_intent.payment_failed events.
Listen for these events rather than waiting on a callback from the client. On the client, the customer could close the browser window or quit the app before the callback executes, and malicious clients could manipulate the response. Setting up your integration to listen for asynchronous events is what enables you to accept different types of payment methods with a single integration.