#eduardo-payment-integration

1 messages · Page 1 of 1 (latest)

jagged gobletBOT
kindred timber
#

@strong ridge hello! What's your exact/detailed question?

#

@strong ridge are you around?

strong ridge
#

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, })

kindred timber
#

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 ?

strong ridge
#

Hi

#

Sorry

#

Like I said, I'm using Stripe Elements to request the credit card data...

#

Just a moment

kindred timber
#

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.

strong ridge
#

I will send a image

#

Just a moment

jagged gobletBOT
strong ridge
#

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

kindred timber
#

so you charge off session right? Which docs did you follow?

strong ridge
#

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 ?

kindred timber
strong ridge
#

I didn't check this doc, so I should not use Stripe elements ?

kindred timber
#

😅

#

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

strong ridge
#

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 ?

analog summit
#

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.

strong ridge
#

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 ...

analog summit
#

Yes, you have to have one because the customer may need to complete 3DS authentication, which requires a page to redirect to

strong ridge
#

`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]

)
`

analog summit
#

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

strong ridge
#

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

analog summit
#

No, you have to allow for 3DS to trigger when it is required

strong ridge
#

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 ?

analog summit
#

I don't understand what the problem is. 3DS authentication happens before a payment is created. No 3DS means no payment.

strong ridge
#

Just for me to understand

#

Using paymentIntent I don't have this step, right ?

analog summit
#

You still have this step with Payment Intent, and every other payments product at Stripe

strong ridge
#

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

analog summit
#

Sometimes it is required, sometimes it is not. You still have to account for the possibility when it does require it

strong ridge
#

So it is because it was a test

#

Now a days every flag of credit cards, use it?

analog summit
#

Some do, some don't. It depends on the logic of each individual card issuer

strong ridge
#

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

analog summit
#

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

strong ridge
#

Ok. Last point, just for me to checked if I understand:

#
  1. I will collect customer credit card data with 3DS if required
#
  1. I will save this info in my database
#
  1. 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
#
  1. I will have to ask again for the customer to confirmPayment with 3DS if required
#

There is no way to jump this last action, right. I as a provider execute this 4 step?

analog summit
#

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

strong ridge
#

Ohhhh

#

Great

analog summit
#

Or a similar series of steps, but the point is that you don't have to auth twice

strong ridge
#

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

analog summit
#

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

strong ridge
#

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?

analog summit
#

That's just the URL that we direct your customer to when they finish 3DS

strong ridge
#

Ok

#

Nice

#

I think that I understood everything that I needed

#

Ty two-shoes

analog summit
#

Sure thing!