I have integrated Stripe for payments. I managed to save a card by obtaining the token, created the customer, and associated the token with the customer. Now I am trying to make a backend (node) side payments using this code:
const createCharge = await stripe.charges.create({
amount,
currency: 'eur',
customer: user.stripeCustomerId,
card: cardId,
description: `userId: ${user._id}`,
});
If the card does not require authentication it works perfectly while if authentication is required it obviously fails with the error: authentication_required.
I tried to add authentication with 3d secure in-app but without success, this is what I tried but I always get errors and no authentication is done
const { paymentIntent, error } = await confirmPayment(clientSecret.client_secret, {
payment_method_options:{
"card": {
"installments": null,
"network": null,
"request_three_d_secure": "any"
}
},
type: 'Card',
cardDetails: this.props.cardList[0].cardId,
payment_method:'creditCard',
setupFutureUsage: 'OffSession',
});
Does anyone have any idea what I'm doing wrong? Thanks!