Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- processStripePayment() {
- window['stripe'].confirmCardPayment(this.clientSecret, {
- payment_method: {
- card: this.card,
- billing_details: {
- name: this.customerName
- }
- }
- }).then((result) => {
- console.log(':: RESULT', result);
- if (result.error) {
- // Show error to your customer (e.g., insufficient funds)
- console.log(result.error.message);
- this.isError = true;
- this.errorMessage = result.error.message;
- this.sendingRequest = false;
- if (result.error && result.error.payment_intent && result.error.payment_intent.status === 'canceled') {
- this.clientSecret = null;
- }
- } else {
- // The payment has been processed!
- if (result.paymentIntent.status === 'succeeded') {
- this.paymentStatus = WidgetStatus.SUCCESS;
- this.openPage('success');
- this.isError = false;
- this.errorMessage = '';
- this.sendingRequest = false;
- // 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