#cheqo.
1 messages · Page 1 of 1 (latest)
Hi! Let me help you with this.
Could you please share the PaymentIntent ID pi_xxx and the Request ID req_xxx? https://support.stripe.com/questions/finding-the-id-for-an-api-request
There was a card error when you attempted to charge it, and it was set as off_session: true. Therefore the payment_method wasn't saved on the PaymentIntent: https://dashboard.stripe.com/test/logs/req_VhIipScABoUo4E
You will need to authenticate it separately with an on-session PaymentIntent.
How do I do that? It seems like I am authenticating on session?
In your tests, you are using a card that requires always authentication 4000002760003184
yes
I want to test cases where card needs authentication to be charged
so that I would present something to the user to complete the authentication
Try to confirm that payment_intent using the api confirm by passing the customer and the payment method:
https://stripe.com/docs/api/payment_intents/confirm
so instead of using confirmPayment, I need paymentIntent.confirm?
this is what I was using:
const { error } = await stripe.confirmPayment({
clientSecret: clientSecret,
confirmParams: {
return_url: "http://localhost:3000/settings",
},
});
you can keep that js method, but pass the payment_method with it:
https://stripe.com/docs/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams-payment_method
I am going to try, but typescript tells me that payment_method doesn't exist on confirmParams object
Yes, it did succeeded ✅, but I don't understand why on the docs payment_method is not listed as required property and it doesn't exist on the typescript?
Is this new api?
no, payment_method is required only for payment method that requires 3Ds
is there a way to know if certain card requires 3ds? I thought they all could require 3ds at some point?
is there a way to know if certain card requires 3ds?
You can't know in advance, that's depends on the bank card issuer
okay, so I just have to include it at all times then?
you can add some checks on the API response, and add it just when needed, or added whenever an off session payment didn't passed on backend side
Thanks, so just to make sure, for paymentIntents that needs to reauthenticate, I can use stripe.confirmPayment ?
Because i see a method that explicitly confirms the card - stripe.confirmCardPayment
you should use confirmCardPayment
specifically this overload https://stripe.com/docs/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-existing where you pass the ID of the payment method you were trying to use(it gets detached from the PI if the off-session confirm on the backend fails)
alternatively, you can mount a PaymentElement and use confirmPayment to collect a brand new card and PaymentMethod object and charge that(which is the other approach and the one that https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements#charge-saved-payment-method uses); it depends how you have the UI set up on the frontend for the customer coming back to fix their payment.
So, I would have to mount PaymentElement in both cases?
in the first case, no.
this is what I currently do
if I am using confirmCardPayment what would render the 3ds logic if not PaymentElement ?
it just pops up on the page
okay, and user wouldnt need to reenter their card details, just the confirm the current card with their bank?
yes
Thats great to know, thanks for that!