Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //original code
- var card = elements.create("card", { hidePostalCode: true, style: style });
- card.mount("#card-element");
- //on form sumbit
- stripe.confirmCardPayment(document.getElementById('tbClientSecret').value, {
- payment_method: {
- card: card
- }
- }).then(function (result) {
- if (result.error) {
- // Show error to your customer (e.g., insufficient funds)
- } else {
- // The payment has been processed!
- if (result.paymentIntent.status === 'succeeded') {
- // Show a success message to your customer
- // There's a risk of the customer closing the window before callback
- // execution. Set up a webhook or plugin to listen for the
- // payment_intent.succeeded event that handles any business critical
- // post-payment actions.
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement