#eduardo-payment-integration
1 messages · Page 1 of 1 (latest)
@strong ridge hello! What's your exact/detailed question?
@strong ridge are you around?
Hi, I tried yesteday to understand better what I should do to implement the flow that I need
But I had to be out
We are using stripe to allow dealers execute payment in the automotive business. But we are not allow to charge the
dealer while the vehicle is not delivery yet, but we need to get all information for payment intent. Today I'm using two
products of stripe, Stripe Elements get recovery data from dealer (credit card info) and create payment intent and
stripe API to handle in my backend. How can I execute this flow?
This is how I'm using in the frontend
const result = await stripe.confirmPayment({ elements, confirmParams: {}, redirect: 'if_required', })
And in the backend I'm doing like this...
intent = await stripe.paymentIntents.capture(transport.payment.id, { amount_to_capture: transport.order.updates[WEBHOOK_EVENT.ORDER].newValue || transport.order.baseQuote.price, })
What's blocking you? Which exact docs are you following? Right now you just gave 2 lines of code without much context on the problem
eduardo-payment-integration
@strong ridge ?
Hi
Sorry
Like I said, I'm using Stripe Elements to request the credit card data...
Just a moment
I want to help but this is unfortunately quite unclear. I'm not sure I see what the problem is, what error you get if any, etc.
I'm using Stripe elements to get credit card info from the dealer
And my flow have many steps
One of them is when we delivery the vehicle for the dealer
In this step is when I should execute the payment
Charge the dealer
I can't charge the dealer until this step
so you charge off session right? Which docs did you follow?
So I would check with you, the way that I'm calling in the frontend to create the paymentIntent there is a flag to allow this
And then execute the charge in the backend when I receive this step ?
I assume you read https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements to collect card details upfront for a future payment right?
I didn't check this doc, so I should not use Stripe elements ?
😅
That doc is using Elements exactly like in your picture
Sorry, it's quite hard to help because you do seem totally lost with our docs overall 😦
My understanding of your ask is that you want to collect card details today but only charge that person in X days/weeks. If that's correct, the doc I linked walks you through the entire integration using our SetupIntents API
Ok
Just one more question
It looks like I have to create a customer to follow this flow that you sent to me
But If I don't have this kind of flow in my platform
There is a way to not use customer ?
Hi there 👋 taking over, as my colleague needs to step away
You can create an empty Customer object. You don't need any information in order to create one.
If you look at the API ref, you can see that there are no required fields, which means if you don't have a workflow that accepts customer information, then that's fine: https://stripe.com/docs/api/customers/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
And I need this return_url in the confirmSetup?
I don't have a page to redirect the customer
Should I have that?
Today I was doing like this ...
Yes, you have to have one because the customer may need to complete 3DS authentication, which requires a page to redirect to
`const enhanceOnSubmit = useCallback(
async (event: React.FormEvent<HTMLFormElement>) => {
try {
event.preventDefault()
if (!stripe || !elements) return
setState((previous) => ({ ...previous, loading: true }))
const result = await stripe.confirmPayment({
elements,
confirmParams: {},
redirect: 'if_required',
})
await onSubmit(result)
setState((previous) => ({ ...previous, loading: false, error: result.error?.message }))
} catch (error) {
setState((previous) => ({ ...previous, loading: false }))
throw error
}
},
[elements, onSubmit, stripe]
)
`
I assume that doesn't work, but even if it did, your customer is going to get dropped onto a blank page after they finish their payment and wonder what happened
Ok
Every time for any credit card I will have this 3DS ?
There is no way to not require the customer to confirm payment ?
Because after get credit card data our flow will already begin
No, you have to allow for 3DS to trigger when it is required
But if the customer receive the vehicle and not execute the payment it will be legal problem for me to resolve from my side
So this cenario could happen, right ?
It's a transportation service you know
Can not I execute the confirmPayment in my server after I receive the delivery step ?
I don't understand what the problem is. 3DS authentication happens before a payment is created. No 3DS means no payment.
You still have this step with Payment Intent, and every other payments product at Stripe
But I set as 'if_required' for paymentIntent and it looks like I was able to proceed without that
So I never executed the real charge
Sometimes it is required, sometimes it is not. You still have to account for the possibility when it does require it
Some do, some don't. It depends on the logic of each individual card issuer
You know, I'm a brazilian developer and here in brazil we don't have this kind of proccess yet when I have to buy somenthing in the internet
I just put my card info and execute the payment, but not this process that I told you about charge after
I see. Well, I would be surprised if it doesn't go to Brazil soon. It's intended to help mitigate card fraud. In any case, you still have to account for the possibility or the API will error out as far as I know
Ok. Last point, just for me to checked if I understand:
- I will collect customer credit card data with 3DS if required
- I will save this info in my database
- After I receive the webhook that I nedd to charge the customer I will have to get the info saved in my database and create the
paymentIntent
- I will have to ask again for the customer to
confirmPaymentwith 3DS if required
There is no way to jump this last action, right. I as a provider execute this 4 step?
I will have to ask again for the customer to confirmPayment with 3DS if required
No. Once you've created the Payment Method and the customer succeeds with 3DS, you don't have to have the Customer come back to complete it. You can just submit the payment without them.
All of our tutorials and guides show this series of steps without step #4
Or a similar series of steps, but the point is that you don't have to auth twice
That is what I needed
If the payment failed due to an authentication_required decline code, use the declined PaymentIntent’s client secret with confirmPayment to allow the customer to authenticate the payment.
I thought because of this line.
Here it is showing as checkout too
I'm not sure I understand. You use the client secret from the Payment Intent or the Setup Intent that you created. This can happen either before or after you've accepted the Payment Method and successfully authenticated it
Ok
I was using the paymentIntent
Now I will have to change for setupIntent
I was taking a look return_url param have nothing to do with 3DS, right?
That's just the URL that we direct your customer to when they finish 3DS
Sure thing!