Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. //original code
  2. var card = elements.create("card", { hidePostalCode: true, style: style });
  3. card.mount("#card-element");
  4.  
  5. //on form sumbit
  6. stripe.confirmCardPayment(document.getElementById('tbClientSecret').value, {
  7. payment_method: {
  8. card: card
  9. }
  10. }).then(function (result) {
  11. if (result.error) {
  12. // Show error to your customer (e.g., insufficient funds)
  13. } else {
  14. // The payment has been processed!
  15. if (result.paymentIntent.status === 'succeeded') {
  16. // Show a success message to your customer
  17. // There's a risk of the customer closing the window before callback
  18. // execution. Set up a webhook or plugin to listen for the
  19. // payment_intent.succeeded event that handles any business critical
  20. // post-payment actions.
  21. }
  22. }
  23. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement