Closed abdipramana closed 8 months ago
hi - did you managed to sort this out?
Surprisingly,I tried this way it worked.
try { // get stripe element const cardNumberElement = cardNumber.value.stripeElement; const cardExpiryElement = cardExpiry.value.stripeElement; const cardCvcElement = cardCvc.value.stripeElement;
// confirming the payment.
await elms.value.instance
.confirmCardPayment(state.clientSecret, {
payment_method: {
// https://stripe.com/docs/api/payment_methods/create?lang=node#create_payment_method-card
card: cardNumberElement
},
},
})
.then((result) => {
console.log("result", result);
});
} catch (error) { console.error("Error creating subscription", error); throw error; };
Hi there, I have a question about how to implement multiple elements.
I have a form with three Stripe elements: cardNumber, cardExpiry, and cardCvc. When the user submits the form, I need to retrieve the values entered by the user in these Stripe elements to fill the payment_method card object before sending it to Stripe for payment confirmation.
I've tried using the stripeElement property of each element reference to retrieve the values, but I'm not sure how to properly format the card object to send it with the confirmCardPayment method.
Here's my example code:
Can someone help me with how to properly implement multiple elements and fill the card object? Thanks.