@stripe/stripe-js 1.49.0 → 1.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pure.esm.js +1 -1
- package/dist/pure.js +1 -1
- package/dist/stripe.esm.js +1 -1
- package/dist/stripe.js +1 -1
- package/package.json +1 -1
- package/types/api/payment-methods.d.ts +42 -0
- package/types/stripe-js/elements/card.d.ts +43 -1
- package/types/stripe-js/elements/payment-request-button.d.ts +11 -0
- package/types/stripe-js/elements-group.d.ts +92 -8
- package/types/stripe-js/payment-intents.d.ts +9 -3
- package/types/stripe-js/setup-intents.d.ts +1 -1
- package/types/stripe-js/stripe.d.ts +115 -2
package/dist/pure.esm.js
CHANGED
package/dist/pure.js
CHANGED
package/dist/stripe.esm.js
CHANGED
package/dist/stripe.js
CHANGED
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {StripeElement, StripeElements} from '../stripe-js';
|
|
1
2
|
import {Metadata, MetadataParam, Address} from './shared';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -316,6 +317,47 @@ export interface PaymentMethodCreateParams {
|
|
|
316
317
|
type?: string;
|
|
317
318
|
}
|
|
318
319
|
|
|
320
|
+
export interface CreatePaymentMethodFromElements {
|
|
321
|
+
/**
|
|
322
|
+
* The Elements instance
|
|
323
|
+
*
|
|
324
|
+
* @docs https://stripe.com/docs/js/elements_object
|
|
325
|
+
*/
|
|
326
|
+
elements: StripeElements;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Parameters that will be passed on to the PaymentMethod API
|
|
330
|
+
*
|
|
331
|
+
* @docs https://stripe.com/docs/api/payment_methods/create
|
|
332
|
+
*/
|
|
333
|
+
params?: PaymentMethodCreateParams;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
|
|
337
|
+
*/
|
|
338
|
+
metadata?: MetadataParam;
|
|
339
|
+
}
|
|
340
|
+
export interface CreatePaymentMethodFromElement {
|
|
341
|
+
/**
|
|
342
|
+
* The specific Element used to collect payment details
|
|
343
|
+
*
|
|
344
|
+
* @docs https://stripe.com/docs/js/element
|
|
345
|
+
*/
|
|
346
|
+
element: StripeElement;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Parameters that will be passed on to the PaymentMethod API
|
|
350
|
+
*
|
|
351
|
+
* @docs https://stripe.com/docs/api/payment_methods/create
|
|
352
|
+
*/
|
|
353
|
+
params?: PaymentMethodCreateParams;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
|
|
357
|
+
*/
|
|
358
|
+
metadata?: MetadataParam;
|
|
359
|
+
}
|
|
360
|
+
|
|
319
361
|
export namespace PaymentMethodCreateParams {
|
|
320
362
|
export interface BillingDetails {
|
|
321
363
|
/**
|
|
@@ -109,7 +109,7 @@ export type StripeCardElement = StripeElementBase & {
|
|
|
109
109
|
* The styles of an `CardElement` can be dynamically changed using `element.update`.
|
|
110
110
|
* This method can be used to simulate CSS media queries that automatically adjust the size of elements when viewed on different devices.
|
|
111
111
|
*/
|
|
112
|
-
update(options:
|
|
112
|
+
update(options: StripeCardElementUpdateOptions): void;
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
export interface StripeCardElementOptions {
|
|
@@ -146,6 +146,48 @@ export interface StripeCardElementOptions {
|
|
|
146
146
|
* Default is false.
|
|
147
147
|
*/
|
|
148
148
|
disabled?: boolean;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Hides and disables the Link Button in the Card Element.
|
|
152
|
+
* Default is false.
|
|
153
|
+
*/
|
|
154
|
+
disableLink?: boolean;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export interface StripeCardElementUpdateOptions {
|
|
158
|
+
classes?: StripeElementClasses;
|
|
159
|
+
|
|
160
|
+
style?: StripeElementStyle;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* A pre-filled set of values to include in the input (e.g., `{postalCode: '94110'}`).
|
|
164
|
+
* Note that sensitive card information (card number, CVC, and expiration date) cannot be pre-filled.
|
|
165
|
+
*/
|
|
166
|
+
value?: {postalCode?: string};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Hide the postal code field.
|
|
170
|
+
* Default is `false`.
|
|
171
|
+
* If you are already collecting a full billing address or postal code elsewhere, set this to `true`.
|
|
172
|
+
*/
|
|
173
|
+
hidePostalCode?: boolean;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Appearance of the icon in the Element.
|
|
177
|
+
*/
|
|
178
|
+
iconStyle?: 'default' | 'solid';
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Hides the icon in the Element.
|
|
182
|
+
* Default is `false`.
|
|
183
|
+
*/
|
|
184
|
+
hideIcon?: boolean;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Applies a disabled state to the Element such that user input is not accepted.
|
|
188
|
+
* Default is false.
|
|
189
|
+
*/
|
|
190
|
+
disabled?: boolean;
|
|
149
191
|
}
|
|
150
192
|
|
|
151
193
|
export interface StripeCardElementChangeEvent extends StripeElementChangeEvent {
|
|
@@ -126,6 +126,11 @@ export interface StripePaymentRequestButtonElementOptions {
|
|
|
126
126
|
* The height of the Payment Request Button. Accepts px unit values.
|
|
127
127
|
*/
|
|
128
128
|
height?: string;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The gap between buttons when multile buttons are shown. Accepts px unit values.
|
|
132
|
+
*/
|
|
133
|
+
buttonSpacing?: string;
|
|
129
134
|
};
|
|
130
135
|
};
|
|
131
136
|
|
|
@@ -133,6 +138,12 @@ export interface StripePaymentRequestButtonElementOptions {
|
|
|
133
138
|
* A `PaymentRequest` object used to configure the element.
|
|
134
139
|
*/
|
|
135
140
|
paymentRequest: PaymentRequest;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Disable showing multiple buttons.
|
|
144
|
+
* Default is `false`.
|
|
145
|
+
*/
|
|
146
|
+
disableMultipleButtons?: boolean;
|
|
136
147
|
}
|
|
137
148
|
|
|
138
149
|
export interface StripePaymentRequestButtonElementClickEvent {
|
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
StripeExpressCheckoutElement,
|
|
51
51
|
StripeExpressCheckoutElementOptions,
|
|
52
52
|
} from './elements';
|
|
53
|
+
import {StripeError} from './stripe';
|
|
53
54
|
|
|
54
55
|
export interface StripeElements {
|
|
55
56
|
/**
|
|
@@ -64,6 +65,12 @@ export interface StripeElements {
|
|
|
64
65
|
*/
|
|
65
66
|
fetchUpdates(): Promise<{error?: {message: string; status?: string}}>;
|
|
66
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Before confirming payment, call elements.submit() to validate the state of the
|
|
70
|
+
* Payment Element and collect any data required for wallets.
|
|
71
|
+
*/
|
|
72
|
+
submit(): Promise<{error?: StripeError}>;
|
|
73
|
+
|
|
67
74
|
/////////////////////////////
|
|
68
75
|
/// address
|
|
69
76
|
/////////////////////////////
|
|
@@ -619,7 +626,7 @@ export type StripeElementLocale =
|
|
|
619
626
|
/**
|
|
620
627
|
* Options to create an `Elements` instance with.
|
|
621
628
|
*/
|
|
622
|
-
|
|
629
|
+
interface BaseStripeElementsOptions {
|
|
623
630
|
/**
|
|
624
631
|
* An array of custom fonts, which elements created from the `Elements` object can use.
|
|
625
632
|
*/
|
|
@@ -640,13 +647,6 @@ export interface StripeElementsOptions {
|
|
|
640
647
|
*/
|
|
641
648
|
appearance?: Appearance;
|
|
642
649
|
|
|
643
|
-
/**
|
|
644
|
-
* The client secret for a PaymentIntent or SetupIntent used by the Payment Element.
|
|
645
|
-
*
|
|
646
|
-
* @docs https://stripe.com/docs/api/payment_intents/object#payment_intent_object-client_secret
|
|
647
|
-
*/
|
|
648
|
-
clientSecret?: string;
|
|
649
|
-
|
|
650
650
|
/**
|
|
651
651
|
* Display skeleton loader UI while waiting for Elements to be fully loaded, after they are mounted.
|
|
652
652
|
* Supported for the `payment`, `shippingAddress`, and `linkAuthentication` Elements.
|
|
@@ -664,6 +664,54 @@ export interface StripeElementsOptions {
|
|
|
664
664
|
customerOptions?: CustomerOptions;
|
|
665
665
|
}
|
|
666
666
|
|
|
667
|
+
export interface StripeElementsOptionsClientSecret
|
|
668
|
+
extends BaseStripeElementsOptions {
|
|
669
|
+
/**
|
|
670
|
+
* The client secret for a PaymentIntent or SetupIntent used by the Payment Element.
|
|
671
|
+
*
|
|
672
|
+
* @docs https://stripe.com/docs/api/payment_intents/object#payment_intent_object-client_secret
|
|
673
|
+
*/
|
|
674
|
+
clientSecret?: string;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
export interface StripeElementsOptionsMode extends BaseStripeElementsOptions {
|
|
678
|
+
/**
|
|
679
|
+
* Whether the Payment Element will be used to create a PaymentIntent, SetupIntent, or Subscription.
|
|
680
|
+
*/
|
|
681
|
+
mode?: 'payment' | 'setup' | 'subscription';
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Three character currency code (e.g., usd).
|
|
685
|
+
*/
|
|
686
|
+
currency?: string;
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* The amount to be charged. Shown in Apple Pay, Google Pay, or Buy now pay later UIs, and influences available payment methods.
|
|
690
|
+
*/
|
|
691
|
+
amount?: number;
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Indicates that you intend to make future payments with this PaymentIntent’s payment method.
|
|
695
|
+
*
|
|
696
|
+
* @docs https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage
|
|
697
|
+
*/
|
|
698
|
+
setup_future_usage?: 'off_session' | 'on_session';
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Controls when the funds will be captured from the customer’s account.
|
|
702
|
+
*
|
|
703
|
+
* @docs https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method
|
|
704
|
+
*/
|
|
705
|
+
capture_method?: 'manual' | 'automatic';
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* Instead of using automatic payment methods, declare specific payment methods to enable.
|
|
709
|
+
*
|
|
710
|
+
* @docs https://stripe.com/docs/payments/payment-methods/overview
|
|
711
|
+
*/
|
|
712
|
+
payment_method_types?: string[];
|
|
713
|
+
}
|
|
714
|
+
|
|
667
715
|
/*
|
|
668
716
|
* Updatable options for an `Elements` instance
|
|
669
717
|
*/
|
|
@@ -682,6 +730,42 @@ export interface StripeElementsUpdateOptions {
|
|
|
682
730
|
* @docs https://stripe.com/docs/stripe-js/appearance-api
|
|
683
731
|
*/
|
|
684
732
|
appearance?: Appearance;
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* Whether the Payment Element will be used to create a PaymentIntent, SetupIntent, or Subscription.
|
|
736
|
+
*/
|
|
737
|
+
mode?: 'payment' | 'setup' | 'subscription';
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Three character currency code (e.g., usd).
|
|
741
|
+
*/
|
|
742
|
+
currency?: string;
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* The amount to be charged. Shown in Apple Pay, Google Pay, or Buy now pay later UIs, and influences available payment methods.
|
|
746
|
+
*/
|
|
747
|
+
amount?: number;
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Indicates that you intend to make future payments with this PaymentIntent’s payment method.
|
|
751
|
+
*
|
|
752
|
+
* @docs https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage
|
|
753
|
+
*/
|
|
754
|
+
setup_future_usage?: 'off_session' | 'on_session';
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* Controls when the funds will be captured from the customer’s account.
|
|
758
|
+
*
|
|
759
|
+
* @docs https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method
|
|
760
|
+
*/
|
|
761
|
+
capture_method?: 'manual' | 'automatic';
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Instead of using automatic payment methods, declare specific payment methods to enable.
|
|
765
|
+
*
|
|
766
|
+
* @docs https://stripe.com/docs/payments/payment-methods/overview
|
|
767
|
+
*/
|
|
768
|
+
payment_method_types?: string[];
|
|
685
769
|
}
|
|
686
770
|
|
|
687
771
|
/*
|
|
@@ -41,6 +41,11 @@ export type CreatePaymentMethodData =
|
|
|
41
41
|
| CreatePaymentMethodSofortData
|
|
42
42
|
| CreatePaymentMethodWechatPayData;
|
|
43
43
|
|
|
44
|
+
export {
|
|
45
|
+
CreatePaymentMethodFromElement,
|
|
46
|
+
CreatePaymentMethodFromElements,
|
|
47
|
+
} from '../api';
|
|
48
|
+
|
|
44
49
|
export interface CreatePaymentMethodAlipayData
|
|
45
50
|
extends PaymentMethodCreateParams {
|
|
46
51
|
type: 'alipay';
|
|
@@ -123,7 +128,8 @@ export interface CreatePaymentMethodCardData extends PaymentMethodCreateParams {
|
|
|
123
128
|
card: StripeCardElement | StripeCardNumberElement | {token: string};
|
|
124
129
|
}
|
|
125
130
|
|
|
126
|
-
interface CreatePaymentMethodCashappData
|
|
131
|
+
export interface CreatePaymentMethodCashappData
|
|
132
|
+
extends PaymentMethodCreateParams {
|
|
127
133
|
type: 'cashapp';
|
|
128
134
|
}
|
|
129
135
|
|
|
@@ -652,7 +658,7 @@ export interface ConfirmCardPaymentOptions {
|
|
|
652
658
|
* Data to be sent with a `stripe.confirmCashappPayment` request.
|
|
653
659
|
* Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters.
|
|
654
660
|
*/
|
|
655
|
-
interface ConfirmCashappPaymentData extends PaymentIntentConfirmParams {
|
|
661
|
+
export interface ConfirmCashappPaymentData extends PaymentIntentConfirmParams {
|
|
656
662
|
/**
|
|
657
663
|
* The `id` of an existing [PaymentMethod](https://stripe.com/docs/api/payment_methods).
|
|
658
664
|
* This field is optional if a `PaymentMethod` has already been attached to this `PaymentIntent` or a new `PaymentMethod` will be created.
|
|
@@ -670,7 +676,7 @@ interface ConfirmCashappPaymentData extends PaymentIntentConfirmParams {
|
|
|
670
676
|
/**
|
|
671
677
|
* An options object to control the behavior of `stripe.confirmCashappPayment`.
|
|
672
678
|
*/
|
|
673
|
-
interface ConfirmCashappPaymentOptions {
|
|
679
|
+
export interface ConfirmCashappPaymentOptions {
|
|
674
680
|
/**
|
|
675
681
|
* Set this to `false` if you want to [manually handle the authorization QR code or redirect](https://stripe.com/docs/payments/cash-app-pay/accept-a-payment?platform=web&ui=API#handle-redirect).
|
|
676
682
|
* Default is `true`.
|
|
@@ -42,7 +42,7 @@ export interface ConfirmCardSetupOptions {
|
|
|
42
42
|
handleActions?: boolean;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
interface ConfirmCashappSetupData extends SetupIntentConfirmParams {
|
|
45
|
+
export interface ConfirmCashappSetupData extends SetupIntentConfirmParams {
|
|
46
46
|
/*
|
|
47
47
|
* Either the `id` of an existing [PaymentMethod](https://stripe.com/docs/api/payment_methods), or an object containing data to create a `PaymentMethod` with.
|
|
48
48
|
* This field is optional if a `PaymentMethod` has already been attached to this `SetupIntent`.
|
|
@@ -7,7 +7,11 @@ import * as elements from './elements';
|
|
|
7
7
|
import * as financialConnections from './financial-connections';
|
|
8
8
|
import * as ephemeralKeys from './ephemeral-keys';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
StripeElements,
|
|
12
|
+
StripeElementsOptionsClientSecret,
|
|
13
|
+
StripeElementsOptionsMode,
|
|
14
|
+
} from './elements-group';
|
|
11
15
|
import {CheckoutLocale, RedirectToCheckoutOptions} from './checkout';
|
|
12
16
|
import {PaymentRequestOptions, PaymentRequest} from './payment-request';
|
|
13
17
|
import {StripeElement, StripeElementLocale} from './elements-group';
|
|
@@ -21,8 +25,17 @@ export interface Stripe {
|
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
27
|
* Create an `Elements` instance, which manages a group of elements.
|
|
28
|
+
*
|
|
29
|
+
* https://stripe.com/docs/js/elements_object/create
|
|
30
|
+
*/
|
|
31
|
+
elements(options?: StripeElementsOptionsClientSecret): StripeElements;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Create an `Elements` instance, which manages a group of elements.
|
|
35
|
+
*
|
|
36
|
+
* https://stripe.com/docs/js/elements_object/create_without_intent
|
|
24
37
|
*/
|
|
25
|
-
elements(options?:
|
|
38
|
+
elements(options?: StripeElementsOptionsMode): StripeElements;
|
|
26
39
|
|
|
27
40
|
/////////////////////////////
|
|
28
41
|
/// Checkout
|
|
@@ -61,6 +74,24 @@ export interface Stripe {
|
|
|
61
74
|
redirect: 'if_required';
|
|
62
75
|
}): Promise<PaymentIntentResult>;
|
|
63
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Use `stripe.confirmPayment` to confirm a PaymentIntent using data collected by the [Payment Element](https://stripe.com/docs/js/element/payment_element).
|
|
79
|
+
* When called, `stripe.confirmPayment` will attempt to complete any [required actions](https://stripe.com/docs/payments/intents), such as authenticating your user by displaying a 3DS dialog or redirecting them to a bank authorization page.
|
|
80
|
+
* Your user will be redirected to the return_url you pass once the confirmation is complete.
|
|
81
|
+
*
|
|
82
|
+
* By default, `stripe.confirmPayment` will always redirect to your return_url after a successful confirmation.
|
|
83
|
+
* If you set `redirect: "if_required"`, then `stripe.confirmPayment` will only redirect if your user chooses a redirect-based payment method.
|
|
84
|
+
* Setting `if_required` requires that you handle successful confirmations for redirect-based and non-redirect based payment methods separately.
|
|
85
|
+
*
|
|
86
|
+
* @docs https://stripe.com/docs/js/payment_intents/confirm_payment
|
|
87
|
+
*/
|
|
88
|
+
confirmPayment(options: {
|
|
89
|
+
elements?: StripeElements;
|
|
90
|
+
clientSecret: string;
|
|
91
|
+
confirmParams?: Partial<paymentIntents.ConfirmPaymentData>;
|
|
92
|
+
redirect: 'if_required';
|
|
93
|
+
}): Promise<PaymentIntentResult>;
|
|
94
|
+
|
|
64
95
|
/**
|
|
65
96
|
* Use `stripe.confirmPayment` to confirm a PaymentIntent using data collected by the [Payment Element](https://stripe.com/docs/js/element/payment_element).
|
|
66
97
|
* When called, `stripe.confirmPayment` will attempt to complete any [required actions](https://stripe.com/docs/payments/intents), such as authenticating your user by displaying a 3DS dialog or redirecting them to a bank authorization page.
|
|
@@ -74,6 +105,20 @@ export interface Stripe {
|
|
|
74
105
|
redirect?: 'always';
|
|
75
106
|
}): Promise<never | {error: StripeError}>;
|
|
76
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Use `stripe.confirmPayment` to confirm a PaymentIntent using data collected by the [Payment Element](https://stripe.com/docs/js/element/payment_element).
|
|
110
|
+
* When called, `stripe.confirmPayment` will attempt to complete any [required actions](https://stripe.com/docs/payments/intents), such as authenticating your user by displaying a 3DS dialog or redirecting them to a bank authorization page.
|
|
111
|
+
* Your user will be redirected to the return_url you pass once the confirmation is complete.
|
|
112
|
+
*
|
|
113
|
+
* @docs https://stripe.com/docs/js/payment_intents/confirm_payment
|
|
114
|
+
*/
|
|
115
|
+
confirmPayment(options: {
|
|
116
|
+
elements?: StripeElements;
|
|
117
|
+
clientSecret: string;
|
|
118
|
+
confirmParams: paymentIntents.ConfirmPaymentData;
|
|
119
|
+
redirect?: 'always';
|
|
120
|
+
}): Promise<never | {error: StripeError}>;
|
|
121
|
+
|
|
77
122
|
/**
|
|
78
123
|
* Use `stripe.confirmAcssDebitPayment` in the [Accept a Canadian pre-authorized debit payment](https://stripe.com/docs/payments/acss-debit/accept-a-payment) flow when the customer submits your payment form.
|
|
79
124
|
* When called, it will automatically pop up a modal to collect bank account details and verification, accept the mandate, and confirm the [PaymentIntent](https://stripe.com/docs/api/payment_intents) when the user submits the form.
|
|
@@ -532,6 +577,24 @@ export interface Stripe {
|
|
|
532
577
|
*/
|
|
533
578
|
handleCardAction(clientSecret: string): Promise<PaymentIntentResult>;
|
|
534
579
|
|
|
580
|
+
/**
|
|
581
|
+
* Use `stripe.handleNextAction` in the Payment Intents API finalizing payments on the server flow to finish confirmation of a [PaymentIntent](https://stripe.com/docs/api/payment_intents) or [SetupIntent](https://stripe.com/docs/api/setup_intents) with the `requires_action` status.
|
|
582
|
+
* It will throw an error if the `PaymentIntent` has a different status.
|
|
583
|
+
*
|
|
584
|
+
* Note that `stripe.handleNextAction` may take several seconds to complete.
|
|
585
|
+
* During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner.
|
|
586
|
+
* If you receive an error result, you should be sure to show that error to the customer, re-enable the form, and hide the waiting indicator.
|
|
587
|
+
*
|
|
588
|
+
* Additionally, `stripe.handleNextAction` may trigger a [3D Secure](https://stripe.com/docs/payments/3d-secure) authentication challenge.
|
|
589
|
+
* The authentication challenge requires a context switch that can be hard to follow on a screen-reader.
|
|
590
|
+
* Ensure that your form is accessible by ensuring that success or error messages are clearly read out.
|
|
591
|
+
*
|
|
592
|
+
* @docs https://stripe.com/docs/js/payment_intents/handle_next_action
|
|
593
|
+
*/
|
|
594
|
+
handleNextAction(options: {
|
|
595
|
+
clientSecret: string;
|
|
596
|
+
}): Promise<PaymentIntentResult>;
|
|
597
|
+
|
|
535
598
|
/**
|
|
536
599
|
* Use `stripe.verifyMicrodepositsForPayment` in the [Accept a Canadian pre-authorized debit payment](https://stripe.com/docs/payments/acss-debit/accept-a-payment) flow
|
|
537
600
|
* to verify a customer's bank account with micro-deposits.
|
|
@@ -570,6 +633,24 @@ export interface Stripe {
|
|
|
570
633
|
paymentMethodData: paymentIntents.CreatePaymentMethodData
|
|
571
634
|
): Promise<PaymentMethodResult>;
|
|
572
635
|
|
|
636
|
+
/**
|
|
637
|
+
* Use stripe.createPaymentMethod to convert payment information collected by elements into a [PaymentMethod](https://stripe.com/docs/api/payment_methods) object that you safely pass to your server to use in an API call.
|
|
638
|
+
*
|
|
639
|
+
* @docs https://stripe.com/docs/js/payment_methods/create_payment_method_elements
|
|
640
|
+
*/
|
|
641
|
+
createPaymentMethod(
|
|
642
|
+
options: paymentIntents.CreatePaymentMethodFromElements
|
|
643
|
+
): Promise<PaymentMethodResult>;
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Use stripe.createPaymentMethod to convert payment information collected by elements into a [PaymentMethod](https://stripe.com/docs/api/payment_methods) object that you safely pass to your server to use in an API call.
|
|
647
|
+
*
|
|
648
|
+
* @docs https://stripe.com/docs/js/payment_methods/create_payment_method_elements
|
|
649
|
+
*/
|
|
650
|
+
createPaymentMethod(
|
|
651
|
+
options: paymentIntents.CreatePaymentMethodFromElement
|
|
652
|
+
): Promise<PaymentMethodResult>;
|
|
653
|
+
|
|
573
654
|
/**
|
|
574
655
|
* Retrieve a [PaymentIntent](https://stripe.com/docs/api/payment_intents) using its [client secret](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-client_secret).
|
|
575
656
|
*
|
|
@@ -600,6 +681,24 @@ export interface Stripe {
|
|
|
600
681
|
redirect: 'if_required';
|
|
601
682
|
}): Promise<SetupIntentResult>;
|
|
602
683
|
|
|
684
|
+
/**
|
|
685
|
+
* Use `stripe.confirmSetup` to confirm a SetupIntent using data collected by the [Payment Element](https://stripe.com/docs/js/element/payment_element).
|
|
686
|
+
* When called, `stripe.confirmSetup` will attempt to complete any [required actions](https://stripe.com/docs/payments/intents), such as authenticating your user by displaying a 3DS dialog or redirecting them to a bank authorization page.
|
|
687
|
+
* Your user will be redirected to the return_url you pass once the confirmation is complete.
|
|
688
|
+
*
|
|
689
|
+
* By default, stripe.`confirmSetup` will always redirect to your return_url after a successful confirmation.
|
|
690
|
+
* If you set `redirect: "if_required"`, then `stripe.confirmSetup` will only redirect if your user chooses a redirect-based payment method.
|
|
691
|
+
* Setting `if_required` requires that you handle successful confirmations for redirect-based and non-redirect based payment methods separately.
|
|
692
|
+
*
|
|
693
|
+
* @docs https://stripe.com/docs/js/setup_intents/confirm_setup
|
|
694
|
+
*/
|
|
695
|
+
confirmSetup(options: {
|
|
696
|
+
elements?: StripeElements;
|
|
697
|
+
clientSecret: string;
|
|
698
|
+
confirmParams?: Partial<paymentIntents.ConfirmPaymentData>;
|
|
699
|
+
redirect: 'if_required';
|
|
700
|
+
}): Promise<SetupIntentResult>;
|
|
701
|
+
|
|
603
702
|
/**
|
|
604
703
|
* Use `stripe.confirmSetup` to confirm a SetupIntent using data collected by the [Payment Element](https://stripe.com/docs/js/element/payment_element).
|
|
605
704
|
* When called, `stripe.confirmSetup` will attempt to complete any [required actions](https://stripe.com/docs/payments/intents), such as authenticating your user by displaying a 3DS dialog or redirecting them to a bank authorization page.
|
|
@@ -613,6 +712,20 @@ export interface Stripe {
|
|
|
613
712
|
redirect?: 'always';
|
|
614
713
|
}): Promise<never | {error: StripeError}>;
|
|
615
714
|
|
|
715
|
+
/**
|
|
716
|
+
* Use `stripe.confirmSetup` to confirm a SetupIntent using data collected by the [Payment Element](https://stripe.com/docs/js/element/payment_element).
|
|
717
|
+
* When called, `stripe.confirmSetup` will attempt to complete any [required actions](https://stripe.com/docs/payments/intents), such as authenticating your user by displaying a 3DS dialog or redirecting them to a bank authorization page.
|
|
718
|
+
* Your user will be redirected to the return_url you pass once the confirmation is complete.
|
|
719
|
+
*
|
|
720
|
+
* @docs https://stripe.com/docs/js/setup_intents/confirm_setup
|
|
721
|
+
*/
|
|
722
|
+
confirmSetup(options: {
|
|
723
|
+
elements?: StripeElements;
|
|
724
|
+
clientSecret: string;
|
|
725
|
+
confirmParams: paymentIntents.ConfirmPaymentData;
|
|
726
|
+
redirect?: 'always';
|
|
727
|
+
}): Promise<never | {error: StripeError}>;
|
|
728
|
+
|
|
616
729
|
/**
|
|
617
730
|
* Use `stripe.confirmAcssDebitSetup` to [save details for future payments with pre-authorized debit in Canada](https://stripe.com/docs/payments/acss-debit/set-up-payment).
|
|
618
731
|
* When called, it will automatically pop up a modal to collect bank account details and verification, accept the mandate, and confirm the [SetupIntent](https://stripe.com/docs/api/setup_intents) when the user submits the form.
|