#idhruv - payment intent
1 messages · Page 1 of 1 (latest)
Hi there. One moment
That is expected. You need to provide a payment method now. Take a look at this flow: https://stripe.com/docs/payments/intents
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:
- creating customer (using existing customer id if it exists) (server side)
- passing it to paymentIntent (server side)
- confirming payment intent on UI side (so that it enables extra actions like 3ds popup n such)
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
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
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?
You have to collect the card details in the browser for that to happen
It's not created until this step
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
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
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
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
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
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
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?
You would call confirmCardPayment
i cannot simply cut paste the new workflow as you recommend because i am dealing with tons of legacy code
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