Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Confirm the PaymentIntent without handling potential next actions (yet).
- stripe.confirmCardPayment(
- clientSecret,
- {payment_method: ev.paymentMethod.id},
- {handleActions: false}
- ).then(function(confirmResult) {
- console.log(confirmResult);
- if (confirmResult.error) {
- // Report to the browser that the payment failed, prompting it to
- // re-show the payment interface, or show an error message and close
- // the payment interface.
- ev.complete('fail');
- } else {
- // Report to the browser that the confirmation was successful, prompting
- // it to close the browser payment method collection interface.
- ev.complete('success');
- // Let Stripe.js handle the rest of the payment flow.
- console.log(confirmResult.paymentIntent.status);
- // if authentication is required on this payment, confirm again
- if (confirmResult.paymentIntent.status == "requires_action") {
- stripe.confirmCardPayment(clientSecret).then(function(result) {
- console.log(result);
- if (result.error) {
- // The payment failed -- ask your customer for a new payment method.
- } else {
- // The payment has succeeded.
- }
- });
- }
- }
- });
Add Comment
Please, Sign In to add comment