#idhruv - payment intent

1 messages · Page 1 of 1 (latest)

rich escarp
#

Hi there. One moment

dawn flare
#

i dont understand, the whole purpose of creating the paymentIntent was to create the payment method details inside, i am using new card for which there is no prior pm exist

#

initially because we were creating payment_method earlier we had tons of problems as we were not able to authenticate 3ds

#

here is what i am doing:

  1. creating customer (using existing customer id if it exists) (server side)
  2. passing it to paymentIntent (server side)
  3. confirming payment intent on UI side (so that it enables extra actions like 3ds popup n such)
rich escarp
#

You can use previously saved payment methods to automatically provide a payment method to a payment intent, but if one doesn't exist, you need to collect card details and create a payment method

dawn flare
#

can you please link me to the article that explains us how to collect card details of a new card and create a payment method using paymentIntent api

rich escarp
dawn flare
#

as per this article i am already using payment_method_types: ['card'] while creating paymentIntent, how in the world its not creating payment_method for me?

rich escarp
#

You have to collect the card details in the browser for that to happen

#

It's not created until this step

dawn flare
#

this step is also done

#

card element is created, then mounted

#

right when the field where user enters details is loaded and details are submitted

rich escarp
#

What guide are you using? The guide I linked is for using the Payment Element not the card element

#

And that's not the code for submitting the card details. Just mounting the element

dawn flare
#

there are total 10 tabs opened in my browser, all about payment intents and I am still struggling to find the one which simply puts down steps that can generate a payment_method from the payment intent.

#

unfortunately, i have followed all the links you gave and have verified the same steps in the code. it is all as mentioned

rich escarp
#

Your code does not match the guide I sent

#

You are using an older integration flow

#

What guide are you following that's instructing you to create a card element?

#

The recommended way is with a Payment Element, as shown in the linked guide

dawn flare
#

that code is already written inside by someone from the past team, the card element is created when the user is trying to enter their details here

#

and if i am not wrong the same document link you gave earlier has this inside

rich escarp
#

The docs I linked create a Payment Element

#

That's different than the card element

#

elements.create('payment') vs elements.create('card')

#

The card element is just an older integration flow

#

But in ^ step payment method is automatically created and payment is submitted

#

You can use the card element if you like. It's just not the current recommended flow

dawn flare
#

okay if i have to stick with card element, and if i am creating and mounting it on UI side like shown above, why then when i am creating paymentIntent on server side it doesnt list payment_method with it?

#

do i need to confirm it using confirmCardSetup or confirmPayment?

rich escarp
#

You would call confirmCardPayment

dawn flare
#

i cannot simply cut paste the new workflow as you recommend because i am dealing with tons of legacy code

rich escarp
#

It doesn't list payment method with it because that's not how payment intents work. It doesn't create a payment method automatically. You have to provide payment method details first

#

You pass in the card element object

#

Payment method is created automatically in that step and payment is submitted

dawn flare
#

okay leme try

#

thansk