@stripe/stripe-js 1.49.0 → 1.51.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-method-messaging.d.ts +1 -1
- package/types/stripe-js/elements/payment-request-button.d.ts +11 -0
- package/types/stripe-js/elements-group.d.ts +158 -8
- package/types/stripe-js/payment-intents.d.ts +58 -3
- package/types/stripe-js/setup-intents.d.ts +1 -1
- package/types/stripe-js/stripe.d.ts +127 -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 {
|
|
@@ -55,7 +55,7 @@ export interface StripePaymentMethodMessagingElementOptions {
|
|
|
55
55
|
/**
|
|
56
56
|
* Payment methods to show messaging for.
|
|
57
57
|
*/
|
|
58
|
-
paymentMethods: Array<'afterpay_clearpay' | 'klarna'>;
|
|
58
|
+
paymentMethods: Array<'afterpay_clearpay' | 'klarna' | 'affirm'>;
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* The country the end-buyer is in.
|
|
@@ -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,99 @@ 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
|
+
* Either use mode or clientSecret when creating an Elements group
|
|
678
|
+
*/
|
|
679
|
+
mode?: never;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
export interface StripeElementsOptionsMode extends BaseStripeElementsOptions {
|
|
683
|
+
/**
|
|
684
|
+
* Whether the Payment Element will be used to create a PaymentIntent, SetupIntent, or Subscription.
|
|
685
|
+
*/
|
|
686
|
+
mode?: 'payment' | 'setup' | 'subscription';
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Three character currency code (e.g., usd).
|
|
690
|
+
*/
|
|
691
|
+
currency?: string;
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* The amount to be charged. Shown in Apple Pay, Google Pay, or Buy now pay later UIs, and influences available payment methods.
|
|
695
|
+
*/
|
|
696
|
+
amount?: number;
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* Indicates that you intend to make future payments with this PaymentIntent’s payment method.
|
|
700
|
+
*
|
|
701
|
+
* @docs https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage
|
|
702
|
+
*/
|
|
703
|
+
setupFutureUsage?: 'off_session' | 'on_session';
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Indicates that you intend to make future payments with this PaymentIntent’s payment method.
|
|
707
|
+
*
|
|
708
|
+
* @docs https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage
|
|
709
|
+
*/
|
|
710
|
+
setup_future_usage?: 'off_session' | 'on_session';
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Controls when the funds will be captured from the customer’s account.
|
|
714
|
+
*
|
|
715
|
+
* @docs https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method
|
|
716
|
+
*/
|
|
717
|
+
captureMethod?: 'manual' | 'automatic';
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* Controls when the funds will be captured from the customer’s account.
|
|
721
|
+
*
|
|
722
|
+
* @docs https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method
|
|
723
|
+
*/
|
|
724
|
+
capture_method?: 'manual' | 'automatic';
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* Instead of using automatic payment methods, declare specific payment methods to enable.
|
|
728
|
+
*
|
|
729
|
+
* @docs https://stripe.com/docs/payments/payment-methods/overview
|
|
730
|
+
*/
|
|
731
|
+
paymentMethodTypes?: string[];
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Instead of using automatic payment methods, declare specific payment methods to enable.
|
|
735
|
+
*
|
|
736
|
+
* @docs https://stripe.com/docs/payments/payment-methods/overview
|
|
737
|
+
*/
|
|
738
|
+
payment_method_types?: string[];
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* Allows PaymentMethods to be created from the Elements instance.
|
|
742
|
+
*/
|
|
743
|
+
paymentMethodCreation?: 'manual';
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* Allows PaymentMethods to be created from the Elements instance.
|
|
747
|
+
*/
|
|
748
|
+
payment_method_creation?: 'manual';
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Either use mode or clientSecret when creating an Elements group
|
|
752
|
+
*/
|
|
753
|
+
clientSecret?: never;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
export type StripeElementsOptions =
|
|
757
|
+
| StripeElementsOptionsClientSecret
|
|
758
|
+
| StripeElementsOptionsMode;
|
|
759
|
+
|
|
667
760
|
/*
|
|
668
761
|
* Updatable options for an `Elements` instance
|
|
669
762
|
*/
|
|
@@ -682,6 +775,63 @@ export interface StripeElementsUpdateOptions {
|
|
|
682
775
|
* @docs https://stripe.com/docs/stripe-js/appearance-api
|
|
683
776
|
*/
|
|
684
777
|
appearance?: Appearance;
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Whether the Payment Element will be used to create a PaymentIntent, SetupIntent, or Subscription.
|
|
781
|
+
*/
|
|
782
|
+
mode?: 'payment' | 'setup' | 'subscription';
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* Three character currency code (e.g., usd).
|
|
786
|
+
*/
|
|
787
|
+
currency?: string;
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* The amount to be charged. Shown in Apple Pay, Google Pay, or Buy now pay later UIs, and influences available payment methods.
|
|
791
|
+
*/
|
|
792
|
+
amount?: number;
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Indicates that you intend to make future payments with this PaymentIntent’s payment method.
|
|
796
|
+
*
|
|
797
|
+
* @docs https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage
|
|
798
|
+
*/
|
|
799
|
+
setupFutureUsage?: 'off_session' | 'on_session';
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* Indicates that you intend to make future payments with this PaymentIntent’s payment method.
|
|
803
|
+
*
|
|
804
|
+
* @docs https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage
|
|
805
|
+
*/
|
|
806
|
+
setup_future_usage?: 'off_session' | 'on_session';
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* Controls when the funds will be captured from the customer’s account.
|
|
810
|
+
*
|
|
811
|
+
* @docs https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method
|
|
812
|
+
*/
|
|
813
|
+
captureMethod?: 'manual' | 'automatic';
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Controls when the funds will be captured from the customer’s account.
|
|
817
|
+
*
|
|
818
|
+
* @docs https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method
|
|
819
|
+
*/
|
|
820
|
+
capture_method?: 'manual' | 'automatic';
|
|
821
|
+
|
|
822
|
+
/**
|
|
823
|
+
* Instead of using automatic payment methods, declare specific payment methods to enable.
|
|
824
|
+
*
|
|
825
|
+
* @docs https://stripe.com/docs/payments/payment-methods/overview
|
|
826
|
+
*/
|
|
827
|
+
payment_method_types?: string[];
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* Instead of using automatic payment methods, declare specific payment methods to enable.
|
|
831
|
+
*
|
|
832
|
+
* @docs https://stripe.com/docs/payments/payment-methods/overview
|
|
833
|
+
*/
|
|
834
|
+
paymentMethodTypes?: string[];
|
|
685
835
|
}
|
|
686
836
|
|
|
687
837
|
/*
|
|
@@ -20,6 +20,7 @@ export type CreatePaymentMethodData =
|
|
|
20
20
|
| CreatePaymentMethodAuBecsDebitData
|
|
21
21
|
| CreatePaymentMethodBacsDebitData
|
|
22
22
|
| CreatePaymentMethodBancontactData
|
|
23
|
+
| CreatePaymentMethodBlikData
|
|
23
24
|
| CreatePaymentMethodBoletoData
|
|
24
25
|
| CreatePaymentMethodCardData
|
|
25
26
|
| CreatePaymentMethodCashappData
|
|
@@ -41,6 +42,11 @@ export type CreatePaymentMethodData =
|
|
|
41
42
|
| CreatePaymentMethodSofortData
|
|
42
43
|
| CreatePaymentMethodWechatPayData;
|
|
43
44
|
|
|
45
|
+
export {
|
|
46
|
+
CreatePaymentMethodFromElement,
|
|
47
|
+
CreatePaymentMethodFromElements,
|
|
48
|
+
} from '../api';
|
|
49
|
+
|
|
44
50
|
export interface CreatePaymentMethodAlipayData
|
|
45
51
|
extends PaymentMethodCreateParams {
|
|
46
52
|
type: 'alipay';
|
|
@@ -90,6 +96,15 @@ export interface CreatePaymentMethodBancontactData
|
|
|
90
96
|
};
|
|
91
97
|
}
|
|
92
98
|
|
|
99
|
+
export interface CreatePaymentMethodBlikData extends PaymentMethodCreateParams {
|
|
100
|
+
type: 'blik';
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Details about the BLIK pament method. Currently there are no supported child attributes for this field.
|
|
104
|
+
*/
|
|
105
|
+
blik?: {}; // eslint-disable-line @typescript-eslint/ban-types
|
|
106
|
+
}
|
|
107
|
+
|
|
93
108
|
export interface CreatePaymentMethodBoletoData
|
|
94
109
|
extends PaymentMethodCreateParams {
|
|
95
110
|
type: 'boleto';
|
|
@@ -123,7 +138,8 @@ export interface CreatePaymentMethodCardData extends PaymentMethodCreateParams {
|
|
|
123
138
|
card: StripeCardElement | StripeCardNumberElement | {token: string};
|
|
124
139
|
}
|
|
125
140
|
|
|
126
|
-
interface CreatePaymentMethodCashappData
|
|
141
|
+
export interface CreatePaymentMethodCashappData
|
|
142
|
+
extends PaymentMethodCreateParams {
|
|
127
143
|
type: 'cashapp';
|
|
128
144
|
}
|
|
129
145
|
|
|
@@ -536,6 +552,35 @@ export interface ConfirmBancontactPaymentData
|
|
|
536
552
|
return_url?: string;
|
|
537
553
|
}
|
|
538
554
|
|
|
555
|
+
/**
|
|
556
|
+
* Data to be sent with a `stripe.ConfirmBlikPayment` request.
|
|
557
|
+
* Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters.
|
|
558
|
+
*/
|
|
559
|
+
export interface ConfirmBlikPaymentData extends PaymentIntentConfirmParams {
|
|
560
|
+
/**
|
|
561
|
+
* Either the `id` of an existing [PaymentMethod](https://stripe.com/docs/api/payment_methods), or an object containing data to create a `PaymentMethod` with.
|
|
562
|
+
* This field is optional if a `PaymentMethod` has already been attached to this `PaymentIntent`.
|
|
563
|
+
*
|
|
564
|
+
* @recommended
|
|
565
|
+
*/
|
|
566
|
+
payment_method?: string | Omit<CreatePaymentMethodBlikData, 'type'>;
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* An object containing payment-method-specific configuration to confirm the [PaymentIntent](https://stripe.com/docs/api/payment_intents) with.
|
|
570
|
+
*/
|
|
571
|
+
payment_method_options: {
|
|
572
|
+
/**
|
|
573
|
+
* A configuration for this BLIK payment.
|
|
574
|
+
*/
|
|
575
|
+
blik: {
|
|
576
|
+
/**
|
|
577
|
+
* Your customer's 6-digit BLIK code.
|
|
578
|
+
*/
|
|
579
|
+
code: string;
|
|
580
|
+
};
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
|
|
539
584
|
/**
|
|
540
585
|
* Data to be sent with a `stripe.confirmBoletoPayment` request.
|
|
541
586
|
* Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters.
|
|
@@ -603,6 +648,16 @@ export interface ConfirmBancontactPaymentOptions {
|
|
|
603
648
|
handleActions?: boolean;
|
|
604
649
|
}
|
|
605
650
|
|
|
651
|
+
/**
|
|
652
|
+
* An options object to control the behavior of `stripe.confirmBlikPayment`.
|
|
653
|
+
*/
|
|
654
|
+
export interface ConfirmBlikPaymentOptions {
|
|
655
|
+
/**
|
|
656
|
+
* Set this to false if you want to manually determine if the confirmation has succeeded or failed.
|
|
657
|
+
*/
|
|
658
|
+
handleActions?: boolean;
|
|
659
|
+
}
|
|
660
|
+
|
|
606
661
|
/**
|
|
607
662
|
* Data to be sent with a `stripe.confirmCardPayment` request.
|
|
608
663
|
* Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters.
|
|
@@ -652,7 +707,7 @@ export interface ConfirmCardPaymentOptions {
|
|
|
652
707
|
* Data to be sent with a `stripe.confirmCashappPayment` request.
|
|
653
708
|
* Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters.
|
|
654
709
|
*/
|
|
655
|
-
interface ConfirmCashappPaymentData extends PaymentIntentConfirmParams {
|
|
710
|
+
export interface ConfirmCashappPaymentData extends PaymentIntentConfirmParams {
|
|
656
711
|
/**
|
|
657
712
|
* The `id` of an existing [PaymentMethod](https://stripe.com/docs/api/payment_methods).
|
|
658
713
|
* This field is optional if a `PaymentMethod` has already been attached to this `PaymentIntent` or a new `PaymentMethod` will be created.
|
|
@@ -670,7 +725,7 @@ interface ConfirmCashappPaymentData extends PaymentIntentConfirmParams {
|
|
|
670
725
|
/**
|
|
671
726
|
* An options object to control the behavior of `stripe.confirmCashappPayment`.
|
|
672
727
|
*/
|
|
673
|
-
interface ConfirmCashappPaymentOptions {
|
|
728
|
+
export interface ConfirmCashappPaymentOptions {
|
|
674
729
|
/**
|
|
675
730
|
* 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
731
|
* 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.
|
|
@@ -158,6 +203,18 @@ export interface Stripe {
|
|
|
158
203
|
options?: paymentIntents.ConfirmBancontactPaymentOptions
|
|
159
204
|
): Promise<PaymentIntentResult>;
|
|
160
205
|
|
|
206
|
+
/**
|
|
207
|
+
* Use `stripe.confirmBlikPayment` in the [BLIK Payments with Payment Methods](https://stripe.com/docs/payments/blik) flow when the customer submits your payment form.
|
|
208
|
+
* When called, it will confirm the PaymentIntent with data you provide, and it will automatically prompt the customer to authorize the transaction.
|
|
209
|
+
*
|
|
210
|
+
* @docs https://stripe.com/docs/js/payment_intents/confirm_blik_payment
|
|
211
|
+
*/
|
|
212
|
+
confirmBlikPayment(
|
|
213
|
+
clientSecret: string,
|
|
214
|
+
data: paymentIntents.ConfirmBlikPaymentData,
|
|
215
|
+
options?: paymentIntents.ConfirmBlikPaymentOptions
|
|
216
|
+
): Promise<PaymentIntentResult>;
|
|
217
|
+
|
|
161
218
|
/**
|
|
162
219
|
* Use `stripe.confirmBoletoPayment` in the [Boleto Payment](https://stripe.com/docs/payments/boleto) with Payment Methods flow when the customer submits your payment form.
|
|
163
220
|
* When called, it will confirm the [PaymentIntent](https://stripe.com/docs/api/payment_intents) with `data` you provide.
|
|
@@ -532,6 +589,24 @@ export interface Stripe {
|
|
|
532
589
|
*/
|
|
533
590
|
handleCardAction(clientSecret: string): Promise<PaymentIntentResult>;
|
|
534
591
|
|
|
592
|
+
/**
|
|
593
|
+
* 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.
|
|
594
|
+
* It will throw an error if the `PaymentIntent` has a different status.
|
|
595
|
+
*
|
|
596
|
+
* Note that `stripe.handleNextAction` may take several seconds to complete.
|
|
597
|
+
* During that time, you should disable your form from being resubmitted and show a waiting indicator like a spinner.
|
|
598
|
+
* 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.
|
|
599
|
+
*
|
|
600
|
+
* Additionally, `stripe.handleNextAction` may trigger a [3D Secure](https://stripe.com/docs/payments/3d-secure) authentication challenge.
|
|
601
|
+
* The authentication challenge requires a context switch that can be hard to follow on a screen-reader.
|
|
602
|
+
* Ensure that your form is accessible by ensuring that success or error messages are clearly read out.
|
|
603
|
+
*
|
|
604
|
+
* @docs https://stripe.com/docs/js/payment_intents/handle_next_action
|
|
605
|
+
*/
|
|
606
|
+
handleNextAction(options: {
|
|
607
|
+
clientSecret: string;
|
|
608
|
+
}): Promise<PaymentIntentResult>;
|
|
609
|
+
|
|
535
610
|
/**
|
|
536
611
|
* Use `stripe.verifyMicrodepositsForPayment` in the [Accept a Canadian pre-authorized debit payment](https://stripe.com/docs/payments/acss-debit/accept-a-payment) flow
|
|
537
612
|
* to verify a customer's bank account with micro-deposits.
|
|
@@ -570,6 +645,24 @@ export interface Stripe {
|
|
|
570
645
|
paymentMethodData: paymentIntents.CreatePaymentMethodData
|
|
571
646
|
): Promise<PaymentMethodResult>;
|
|
572
647
|
|
|
648
|
+
/**
|
|
649
|
+
* 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.
|
|
650
|
+
*
|
|
651
|
+
* @docs https://stripe.com/docs/js/payment_methods/create_payment_method_elements
|
|
652
|
+
*/
|
|
653
|
+
createPaymentMethod(
|
|
654
|
+
options: paymentIntents.CreatePaymentMethodFromElements
|
|
655
|
+
): Promise<PaymentMethodResult>;
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* 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.
|
|
659
|
+
*
|
|
660
|
+
* @docs https://stripe.com/docs/js/payment_methods/create_payment_method_elements
|
|
661
|
+
*/
|
|
662
|
+
createPaymentMethod(
|
|
663
|
+
options: paymentIntents.CreatePaymentMethodFromElement
|
|
664
|
+
): Promise<PaymentMethodResult>;
|
|
665
|
+
|
|
573
666
|
/**
|
|
574
667
|
* 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
668
|
*
|
|
@@ -600,6 +693,24 @@ export interface Stripe {
|
|
|
600
693
|
redirect: 'if_required';
|
|
601
694
|
}): Promise<SetupIntentResult>;
|
|
602
695
|
|
|
696
|
+
/**
|
|
697
|
+
* Use `stripe.confirmSetup` to confirm a SetupIntent using data collected by the [Payment Element](https://stripe.com/docs/js/element/payment_element).
|
|
698
|
+
* 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.
|
|
699
|
+
* Your user will be redirected to the return_url you pass once the confirmation is complete.
|
|
700
|
+
*
|
|
701
|
+
* By default, stripe.`confirmSetup` will always redirect to your return_url after a successful confirmation.
|
|
702
|
+
* If you set `redirect: "if_required"`, then `stripe.confirmSetup` will only redirect if your user chooses a redirect-based payment method.
|
|
703
|
+
* Setting `if_required` requires that you handle successful confirmations for redirect-based and non-redirect based payment methods separately.
|
|
704
|
+
*
|
|
705
|
+
* @docs https://stripe.com/docs/js/setup_intents/confirm_setup
|
|
706
|
+
*/
|
|
707
|
+
confirmSetup(options: {
|
|
708
|
+
elements?: StripeElements;
|
|
709
|
+
clientSecret: string;
|
|
710
|
+
confirmParams?: Partial<paymentIntents.ConfirmPaymentData>;
|
|
711
|
+
redirect: 'if_required';
|
|
712
|
+
}): Promise<SetupIntentResult>;
|
|
713
|
+
|
|
603
714
|
/**
|
|
604
715
|
* Use `stripe.confirmSetup` to confirm a SetupIntent using data collected by the [Payment Element](https://stripe.com/docs/js/element/payment_element).
|
|
605
716
|
* 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 +724,20 @@ export interface Stripe {
|
|
|
613
724
|
redirect?: 'always';
|
|
614
725
|
}): Promise<never | {error: StripeError}>;
|
|
615
726
|
|
|
727
|
+
/**
|
|
728
|
+
* Use `stripe.confirmSetup` to confirm a SetupIntent using data collected by the [Payment Element](https://stripe.com/docs/js/element/payment_element).
|
|
729
|
+
* 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.
|
|
730
|
+
* Your user will be redirected to the return_url you pass once the confirmation is complete.
|
|
731
|
+
*
|
|
732
|
+
* @docs https://stripe.com/docs/js/setup_intents/confirm_setup
|
|
733
|
+
*/
|
|
734
|
+
confirmSetup(options: {
|
|
735
|
+
elements?: StripeElements;
|
|
736
|
+
clientSecret: string;
|
|
737
|
+
confirmParams: paymentIntents.ConfirmPaymentData;
|
|
738
|
+
redirect?: 'always';
|
|
739
|
+
}): Promise<never | {error: StripeError}>;
|
|
740
|
+
|
|
616
741
|
/**
|
|
617
742
|
* 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
743
|
* 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.
|