@stripe/stripe-js 4.10.0 → 5.1.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/api/confirmation-tokens.d.mts +0 -3
- package/dist/api/confirmation-tokens.d.ts +0 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/pure.js +1 -1
- package/dist/pure.mjs +1 -1
- package/dist/stripe-js/checkout.d.mts +467 -126
- package/dist/stripe-js/checkout.d.ts +467 -126
- package/dist/stripe-js/elements/currency-selector.d.mts +93 -0
- package/dist/stripe-js/elements/currency-selector.d.ts +93 -0
- package/dist/stripe-js/elements/express-checkout.d.mts +3 -0
- package/dist/stripe-js/elements/express-checkout.d.ts +3 -0
- package/dist/stripe-js/elements/index.d.mts +1 -0
- package/dist/stripe-js/elements/index.d.ts +1 -0
- package/dist/stripe-js/elements/payment.d.mts +136 -0
- package/dist/stripe-js/elements/payment.d.ts +136 -0
- package/dist/stripe-js/elements-group.d.mts +37 -7
- package/dist/stripe-js/elements-group.d.ts +37 -7
- package/dist/stripe-js/embedded-checkout.d.mts +30 -0
- package/dist/stripe-js/embedded-checkout.d.ts +30 -0
- package/dist/stripe-js/hosted-checkout.d.mts +153 -0
- package/dist/stripe-js/hosted-checkout.d.ts +153 -0
- package/dist/stripe-js/index.d.mts +1 -1
- package/dist/stripe-js/index.d.ts +1 -1
- package/dist/stripe-js/payment-intents.d.mts +79 -3
- package/dist/stripe-js/payment-intents.d.ts +79 -3
- package/dist/stripe-js/setup-intents.d.mts +0 -3
- package/dist/stripe-js/setup-intents.d.ts +0 -3
- package/dist/stripe-js/stripe.d.mts +38 -8
- package/dist/stripe-js/stripe.d.ts +38 -8
- package/package.json +1 -1
- package/dist/stripe-js/custom-checkout.d.mts +0 -437
- package/dist/stripe-js/custom-checkout.d.ts +0 -437
|
@@ -84,9 +84,6 @@ export interface ConfirmationTokenCreateParams {
|
|
|
84
84
|
billing_details?: PaymentMethodCreateParams.BillingDetails;
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
-
* Requires beta access:
|
|
88
|
-
* Contact [Stripe support](https://support.stripe.com/) for more information.
|
|
89
|
-
*
|
|
90
87
|
* Specifies if the PaymentMethod should be redisplayed when using the Saved Payment Method feature
|
|
91
88
|
*/
|
|
92
89
|
allow_redisplay?: 'always' | 'limited' | 'unspecified';
|
|
@@ -84,9 +84,6 @@ export interface ConfirmationTokenCreateParams {
|
|
|
84
84
|
billing_details?: PaymentMethodCreateParams.BillingDetails;
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
-
* Requires beta access:
|
|
88
|
-
* Contact [Stripe support](https://support.stripe.com/) for more information.
|
|
89
|
-
*
|
|
90
87
|
* Specifies if the PaymentMethod should be redisplayed when using the Saved Payment Method feature
|
|
91
88
|
*/
|
|
92
89
|
allow_redisplay?: 'always' | 'limited' | 'unspecified';
|
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED
package/dist/pure.js
CHANGED
package/dist/pure.mjs
CHANGED
|
@@ -1,153 +1,494 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {
|
|
2
|
+
LayoutObject,
|
|
3
|
+
Layout,
|
|
4
|
+
TermsOption,
|
|
5
|
+
StripePaymentElement,
|
|
6
|
+
} from './elements/payment';
|
|
7
|
+
import {
|
|
8
|
+
AddressMode,
|
|
9
|
+
ContactOption,
|
|
10
|
+
StripeAddressElement,
|
|
11
|
+
} from './elements/address';
|
|
12
|
+
import {Appearance, CssFontSource, CustomFontSource} from './elements-group';
|
|
13
|
+
import {StripeError} from './stripe';
|
|
14
|
+
import {
|
|
15
|
+
StripeCurrencySelectorElement,
|
|
16
|
+
FieldsOption,
|
|
17
|
+
StripeElementBase,
|
|
18
|
+
StripeExpressCheckoutElement,
|
|
19
|
+
StripeExpressCheckoutElementConfirmEvent,
|
|
20
|
+
StripeExpressCheckoutElementOptions,
|
|
21
|
+
StripeExpressCheckoutElementReadyEvent,
|
|
22
|
+
} from './elements';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Requires beta access:
|
|
26
|
+
* Contact [Stripe support](https://support.stripe.com/) for more information.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export interface StripeCheckoutElementsOptions {
|
|
30
|
+
appearance?: Appearance;
|
|
31
|
+
loader?: 'auto' | 'always' | 'never';
|
|
32
|
+
fonts?: Array<CssFontSource | CustomFontSource>;
|
|
6
33
|
}
|
|
7
34
|
|
|
8
|
-
export interface
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
successUrl: string;
|
|
35
|
+
export interface StripeCheckoutOptions {
|
|
36
|
+
clientSecret: string;
|
|
37
|
+
elementsOptions?: StripeCheckoutElementsOptions;
|
|
38
|
+
}
|
|
14
39
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
40
|
+
/* Elements with CheckoutSessions API types */
|
|
41
|
+
export type StripeCheckoutAddress = {
|
|
42
|
+
country: string;
|
|
43
|
+
line1?: string | null;
|
|
44
|
+
line2?: string | null;
|
|
45
|
+
city?: string | null;
|
|
46
|
+
postal_code?: string | null;
|
|
47
|
+
state?: string | null;
|
|
48
|
+
};
|
|
19
49
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
lineItems?: Array<{
|
|
25
|
-
/**
|
|
26
|
-
* The ID of the price that the customer would like to purchase. SKU or plan IDs may also be used.
|
|
27
|
-
*/
|
|
28
|
-
price?: string;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* The quantity of units for the item.
|
|
32
|
-
*/
|
|
33
|
-
quantity?: number;
|
|
34
|
-
}>;
|
|
50
|
+
export type StripeCheckoutAdjustableQuantity = {
|
|
51
|
+
maximum: number;
|
|
52
|
+
minimum: number;
|
|
53
|
+
};
|
|
35
54
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
export type StripeCheckoutBillingInterval = 'day' | 'month' | 'week' | 'year';
|
|
56
|
+
|
|
57
|
+
export type StripeCheckoutConfirmationRequirement =
|
|
58
|
+
| 'phoneNumber'
|
|
59
|
+
| 'shippingAddress'
|
|
60
|
+
| 'billingAddress'
|
|
61
|
+
| 'paymentDetails'
|
|
62
|
+
| 'email';
|
|
63
|
+
|
|
64
|
+
export type StripeCheckoutContact = {
|
|
65
|
+
name?: string | null;
|
|
66
|
+
address: StripeCheckoutAddress;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export type StripeCheckoutDeliveryEstimate = {
|
|
70
|
+
maximum: StripeCheckoutEstimate | null;
|
|
71
|
+
minimum: StripeCheckoutEstimate | null;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export type StripeCheckoutDiscountAmount = {
|
|
75
|
+
amount: number;
|
|
76
|
+
displayName: string;
|
|
77
|
+
promotionCode: string | null;
|
|
78
|
+
recurring:
|
|
79
|
+
| {type: 'forever'}
|
|
80
|
+
| {type: 'repeating'; durationInMonths: number}
|
|
81
|
+
| null;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export type StripeCheckoutDueNext = {
|
|
85
|
+
amountSubtotal: number;
|
|
86
|
+
amountDiscount: number;
|
|
87
|
+
amountTaxInclusive: number;
|
|
88
|
+
amountTaxExclusive: number;
|
|
89
|
+
billingCycleAnchor: number | null;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export type StripeCheckoutEstimate = {
|
|
93
|
+
unit: 'business_day' | 'day' | 'hour' | 'week' | 'month';
|
|
94
|
+
value: number;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export type StripeCheckoutLastPaymentError = {
|
|
98
|
+
message: string;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export type StripeCheckoutRedirectBehavior = 'always' | 'if_required';
|
|
102
|
+
|
|
103
|
+
export type StripeCheckoutSavedPaymentMethod = {
|
|
104
|
+
id: string;
|
|
105
|
+
type: 'card';
|
|
106
|
+
card: {
|
|
107
|
+
brand: string;
|
|
108
|
+
expMonth: number;
|
|
109
|
+
expYear: number;
|
|
110
|
+
last4: string;
|
|
111
|
+
};
|
|
112
|
+
billingDetails: {
|
|
113
|
+
email?: string | null;
|
|
114
|
+
name?: string | null;
|
|
115
|
+
phone?: string | null;
|
|
116
|
+
address?: {
|
|
117
|
+
line1?: string | null;
|
|
118
|
+
line2?: string | null;
|
|
119
|
+
city?: string | null;
|
|
120
|
+
postal_code?: string | null;
|
|
121
|
+
state?: string | null;
|
|
122
|
+
country?: string | null;
|
|
123
|
+
} | null;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export type StripeCheckoutTaxAmount = {
|
|
128
|
+
amount: number;
|
|
129
|
+
inclusive: boolean;
|
|
130
|
+
displayName: string;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export type StripeCheckoutLineItem = {
|
|
134
|
+
id: string;
|
|
135
|
+
name: string;
|
|
136
|
+
amountDiscount: number;
|
|
137
|
+
amountSubtotal: number;
|
|
138
|
+
amountTaxExclusive: number;
|
|
139
|
+
amountTaxInclusive: number;
|
|
140
|
+
unitAmount: number;
|
|
141
|
+
description: string | null;
|
|
142
|
+
quantity: number;
|
|
143
|
+
discountAmounts: Array<StripeCheckoutDiscountAmount> | null;
|
|
144
|
+
taxAmounts: Array<StripeCheckoutTaxAmount> | null;
|
|
145
|
+
recurring: {
|
|
146
|
+
interval: StripeCheckoutBillingInterval;
|
|
147
|
+
intervalCount: number;
|
|
148
|
+
isProrated: boolean;
|
|
149
|
+
usageType: 'metered' | 'licensed';
|
|
150
|
+
} | null;
|
|
151
|
+
adjustableQuantity: StripeCheckoutAdjustableQuantity | null;
|
|
152
|
+
images: string[];
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export type StripeCheckoutRecurring = {
|
|
156
|
+
interval: StripeCheckoutBillingInterval;
|
|
157
|
+
intervalCount: number;
|
|
158
|
+
dueNext: StripeCheckoutDueNext;
|
|
159
|
+
trial: StripeCheckoutTrial | null;
|
|
160
|
+
};
|
|
58
161
|
|
|
162
|
+
export type StripeCheckoutShipping = {
|
|
163
|
+
shippingOption: StripeCheckoutShippingOption;
|
|
164
|
+
taxAmounts: Array<StripeCheckoutTaxAmount> | null;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export type StripeCheckoutShippingOption = {
|
|
168
|
+
id: string;
|
|
169
|
+
amount: number;
|
|
170
|
+
currency: string;
|
|
171
|
+
displayName: string | null;
|
|
172
|
+
deliveryEstimate: StripeCheckoutDeliveryEstimate | null;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export type StripeCheckoutStatus =
|
|
176
|
+
| {type: 'open'}
|
|
177
|
+
| {type: 'expired'}
|
|
178
|
+
| {
|
|
179
|
+
type: 'complete';
|
|
180
|
+
paymentStatus: 'paid' | 'unpaid' | 'no_payment_required';
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export type StripeCheckoutTaxStatus =
|
|
184
|
+
| {status: 'ready'}
|
|
185
|
+
| {status: 'requires_shipping_address'}
|
|
186
|
+
| {status: 'requires_billing_address'};
|
|
187
|
+
|
|
188
|
+
export type StripeCheckoutTotalSummary = {
|
|
189
|
+
appliedBalance: number;
|
|
190
|
+
balanceAppliedToNextInvoice: boolean;
|
|
191
|
+
discount: number;
|
|
192
|
+
shippingRate: number;
|
|
193
|
+
subtotal: number;
|
|
194
|
+
taxExclusive: number;
|
|
195
|
+
taxInclusive: number;
|
|
196
|
+
total: number;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export type StripeCheckoutTrial = {
|
|
200
|
+
trialEnd: number;
|
|
201
|
+
trialPeriodDays: number;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export type StripeCheckoutCurrencyOption = {
|
|
205
|
+
amount: number;
|
|
206
|
+
currency: string;
|
|
207
|
+
currencyConversion?: {fxRate: number; sourceCurrency: string};
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
/* Custom Checkout session */
|
|
211
|
+
export interface StripeCheckoutSession {
|
|
212
|
+
billingAddress: StripeCheckoutContact | null;
|
|
213
|
+
businessName: string | null;
|
|
214
|
+
canConfirm: boolean;
|
|
215
|
+
confirmationRequirements: StripeCheckoutConfirmationRequirement[];
|
|
216
|
+
currency: string;
|
|
217
|
+
currencyOptions: Array<StripeCheckoutCurrencyOption> | null;
|
|
218
|
+
discountAmounts: Array<StripeCheckoutDiscountAmount> | null;
|
|
219
|
+
email: string | null;
|
|
220
|
+
id: string;
|
|
221
|
+
lastPaymentError: StripeCheckoutLastPaymentError | null;
|
|
222
|
+
lineItems: Array<StripeCheckoutLineItem>;
|
|
223
|
+
livemode: boolean;
|
|
224
|
+
phoneNumber: string | null;
|
|
225
|
+
recurring: StripeCheckoutRecurring | null;
|
|
226
|
+
savedPaymentMethods: Array<StripeCheckoutSavedPaymentMethod> | null;
|
|
227
|
+
shipping: StripeCheckoutShipping | null;
|
|
228
|
+
shippingAddress: StripeCheckoutContact | null;
|
|
229
|
+
shippingOptions: Array<StripeCheckoutShippingOption>;
|
|
230
|
+
status: StripeCheckoutStatus;
|
|
231
|
+
tax: StripeCheckoutTaxStatus;
|
|
232
|
+
taxAmounts: Array<StripeCheckoutTaxAmount> | null;
|
|
233
|
+
total: StripeCheckoutTotalSummary;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export type StripeCheckoutResult =
|
|
237
|
+
| {session: StripeCheckoutSession; error?: undefined}
|
|
238
|
+
| {session?: undefined; error: StripeError};
|
|
239
|
+
|
|
240
|
+
export type StripeCheckoutPaymentElementOptions = {
|
|
241
|
+
layout?: Layout | LayoutObject;
|
|
242
|
+
paymentMethodOrder?: Array<string>;
|
|
243
|
+
readonly?: boolean;
|
|
244
|
+
terms?: TermsOption;
|
|
245
|
+
fields?: FieldsOption;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
export type StripeCheckoutAddressElementOptions = {
|
|
249
|
+
mode: AddressMode;
|
|
250
|
+
contacts?: ContactOption[];
|
|
251
|
+
display?: {
|
|
252
|
+
name?: 'full' | 'split' | 'organization';
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
export type StripeCheckoutExpressCheckoutElementOptions = {
|
|
257
|
+
buttonHeight: StripeExpressCheckoutElementOptions['buttonHeight'];
|
|
258
|
+
buttonTheme: StripeExpressCheckoutElementOptions['buttonTheme'];
|
|
259
|
+
buttonType: StripeExpressCheckoutElementOptions['buttonType'];
|
|
260
|
+
layout: StripeExpressCheckoutElementOptions['layout'];
|
|
261
|
+
paymentMethodOrder: StripeExpressCheckoutElementOptions['paymentMethodOrder'];
|
|
262
|
+
paymentMethods: StripeExpressCheckoutElementOptions['paymentMethods'];
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
export type StripeCheckoutUpdateHandler = (
|
|
266
|
+
session: StripeCheckoutSession
|
|
267
|
+
) => void;
|
|
268
|
+
|
|
269
|
+
export type StripeCheckoutExpressCheckoutElement = StripeElementBase & {
|
|
59
270
|
/**
|
|
60
|
-
*
|
|
271
|
+
* Triggered when the element is fully rendered.
|
|
61
272
|
*/
|
|
62
|
-
|
|
273
|
+
on(
|
|
274
|
+
eventType: 'ready',
|
|
275
|
+
handler: (event: StripeExpressCheckoutElementReadyEvent) => any
|
|
276
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
277
|
+
once(
|
|
278
|
+
eventType: 'ready',
|
|
279
|
+
handler: (event: StripeExpressCheckoutElementReadyEvent) => any
|
|
280
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
281
|
+
off(
|
|
282
|
+
eventType: 'ready',
|
|
283
|
+
handler?: (event: StripeExpressCheckoutElementReadyEvent) => any
|
|
284
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
63
285
|
|
|
64
286
|
/**
|
|
65
|
-
*
|
|
66
|
-
* This can be a customer ID, a cart ID, or similar.
|
|
67
|
-
* It is included in the `checkout.session.completed` webhook and can be used to fulfill the purchase.
|
|
287
|
+
* Triggered when the element gains focus.
|
|
68
288
|
*/
|
|
69
|
-
|
|
289
|
+
on(
|
|
290
|
+
eventType: 'focus',
|
|
291
|
+
handler: (event: {elementType: 'expressCheckout'}) => any
|
|
292
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
293
|
+
once(
|
|
294
|
+
eventType: 'focus',
|
|
295
|
+
handler: (event: {elementType: 'expressCheckout'}) => any
|
|
296
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
297
|
+
off(
|
|
298
|
+
eventType: 'focus',
|
|
299
|
+
handler?: (event: {elementType: 'expressCheckout'}) => any
|
|
300
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
70
301
|
|
|
71
302
|
/**
|
|
72
|
-
*
|
|
73
|
-
* If you already know your customer's email address, use this attribute to prefill it on Checkout.
|
|
303
|
+
* Triggered when the element loses focus.
|
|
74
304
|
*/
|
|
75
|
-
|
|
305
|
+
on(
|
|
306
|
+
eventType: 'blur',
|
|
307
|
+
handler: (event: {elementType: 'expressCheckout'}) => any
|
|
308
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
309
|
+
once(
|
|
310
|
+
eventType: 'blur',
|
|
311
|
+
handler: (event: {elementType: 'expressCheckout'}) => any
|
|
312
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
313
|
+
off(
|
|
314
|
+
eventType: 'blur',
|
|
315
|
+
handler?: (event: {elementType: 'expressCheckout'}) => any
|
|
316
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
76
317
|
|
|
77
318
|
/**
|
|
78
|
-
*
|
|
79
|
-
* If set to `required`, Checkout will attempt to collect the customer’s billing address.
|
|
80
|
-
* If not set or set to `auto` Checkout will only attempt to collect the billing address when necessary.
|
|
319
|
+
* Triggered when the escape key is pressed within the element.
|
|
81
320
|
*/
|
|
82
|
-
|
|
321
|
+
on(
|
|
322
|
+
eventType: 'escape',
|
|
323
|
+
handler: (event: {elementType: 'expressCheckout'}) => any
|
|
324
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
325
|
+
once(
|
|
326
|
+
eventType: 'escape',
|
|
327
|
+
handler: (event: {elementType: 'expressCheckout'}) => any
|
|
328
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
329
|
+
off(
|
|
330
|
+
eventType: 'escape',
|
|
331
|
+
handler?: (event: {elementType: 'expressCheckout'}) => any
|
|
332
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
83
333
|
|
|
84
334
|
/**
|
|
85
|
-
*
|
|
335
|
+
* Triggered when the element fails to load.
|
|
86
336
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
337
|
+
on(
|
|
338
|
+
eventType: 'loaderror',
|
|
339
|
+
handler: (event: {
|
|
340
|
+
elementType: 'expressCheckout';
|
|
341
|
+
error: StripeError;
|
|
342
|
+
}) => any
|
|
343
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
344
|
+
once(
|
|
345
|
+
eventType: 'loaderror',
|
|
346
|
+
handler: (event: {
|
|
347
|
+
elementType: 'expressCheckout';
|
|
348
|
+
error: StripeError;
|
|
349
|
+
}) => any
|
|
350
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
351
|
+
off(
|
|
352
|
+
eventType: 'loaderror',
|
|
353
|
+
handler?: (event: {
|
|
354
|
+
elementType: 'expressCheckout';
|
|
355
|
+
error: StripeError;
|
|
356
|
+
}) => any
|
|
357
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
95
358
|
|
|
96
359
|
/**
|
|
97
|
-
*
|
|
98
|
-
* Default is `auto` (Stripe detects the locale of the browser).
|
|
360
|
+
* Triggered when a buyer authorizes a payment within a supported payment method.
|
|
99
361
|
*/
|
|
100
|
-
|
|
362
|
+
on(
|
|
363
|
+
eventType: 'confirm',
|
|
364
|
+
handler: (event: StripeExpressCheckoutElementConfirmEvent) => any
|
|
365
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
366
|
+
once(
|
|
367
|
+
eventType: 'confirm',
|
|
368
|
+
handler: (event: StripeExpressCheckoutElementConfirmEvent) => any
|
|
369
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
370
|
+
off(
|
|
371
|
+
eventType: 'confirm',
|
|
372
|
+
handler?: (event: StripeExpressCheckoutElementConfirmEvent) => any
|
|
373
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
101
374
|
|
|
102
375
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* The default is `auto`.
|
|
376
|
+
* Updates the options the `ExpressCheckoutElement` was initialized with.
|
|
377
|
+
* Updates are merged into the existing configuration.
|
|
106
378
|
*/
|
|
107
|
-
|
|
108
|
-
}
|
|
379
|
+
update: StripeExpressCheckoutElement['update'];
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
type AnyBuyerError = {message: string; code: null};
|
|
383
|
+
type ApplyPromotionCodeError =
|
|
384
|
+
| {message: string; code: 'invalidCode'}
|
|
385
|
+
| AnyBuyerError;
|
|
386
|
+
export type StripeCheckoutApplyPromotionCodeResult =
|
|
387
|
+
| {type: 'success'; success: StripeCheckoutSession}
|
|
388
|
+
| {type: 'error'; error: ApplyPromotionCodeError};
|
|
389
|
+
|
|
390
|
+
export type StripeCheckoutRemovePromotionCodeResult =
|
|
391
|
+
| {type: 'success'; success: StripeCheckoutSession}
|
|
392
|
+
| {type: 'error'; error: AnyBuyerError};
|
|
393
|
+
|
|
394
|
+
export type StripeCheckoutUpdateAddressResult =
|
|
395
|
+
| {type: 'success'; success: StripeCheckoutSession}
|
|
396
|
+
| {type: 'error'; error: AnyBuyerError};
|
|
109
397
|
|
|
110
|
-
export type
|
|
111
|
-
|
|
|
112
|
-
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
| '
|
|
116
|
-
| '
|
|
117
|
-
|
|
118
|
-
| '
|
|
119
|
-
| '
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
| '
|
|
123
|
-
| '
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
| '
|
|
127
|
-
| '
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
|
138
|
-
|
|
139
|
-
| '
|
|
140
|
-
| '
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
398
|
+
export type StripeCheckoutUpdatePhoneNumberResult =
|
|
399
|
+
| {type: 'success'; success: StripeCheckoutSession}
|
|
400
|
+
| {type: 'error'; error: never};
|
|
401
|
+
|
|
402
|
+
type UpdateEmailError =
|
|
403
|
+
| {message: string; code: 'incompleteEmail'}
|
|
404
|
+
| {message: string; code: 'invalidEmail'};
|
|
405
|
+
export type StripeCheckoutUpdateEmailResult =
|
|
406
|
+
| {type: 'success'; success: StripeCheckoutSession}
|
|
407
|
+
| {type: 'error'; error: UpdateEmailError};
|
|
408
|
+
|
|
409
|
+
export type StripeCheckoutUpdateLineItemQuantityResult =
|
|
410
|
+
| {type: 'success'; success: StripeCheckoutSession}
|
|
411
|
+
| {type: 'error'; error: AnyBuyerError};
|
|
412
|
+
|
|
413
|
+
export type StripeCheckoutUpdateShippingOptionResult =
|
|
414
|
+
| {type: 'success'; success: StripeCheckoutSession}
|
|
415
|
+
| {type: 'error'; error: AnyBuyerError};
|
|
416
|
+
|
|
417
|
+
type ConfirmError =
|
|
418
|
+
| {
|
|
419
|
+
message: string;
|
|
420
|
+
code: 'paymentFailed';
|
|
421
|
+
paymentFailed: {
|
|
422
|
+
declineCode: string | null;
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
| AnyBuyerError;
|
|
426
|
+
export type StripeCheckoutConfirmResult =
|
|
427
|
+
| {type: 'success'; success: StripeCheckoutSession}
|
|
428
|
+
| {type: 'error'; error: ConfirmError};
|
|
429
|
+
export interface StripeCheckout {
|
|
430
|
+
/* Custom Checkout methods */
|
|
431
|
+
applyPromotionCode: (
|
|
432
|
+
promotionCode: string
|
|
433
|
+
) => Promise<StripeCheckoutApplyPromotionCodeResult>;
|
|
434
|
+
removePromotionCode: () => Promise<StripeCheckoutRemovePromotionCodeResult>;
|
|
435
|
+
updateShippingAddress: (
|
|
436
|
+
shippingAddress: StripeCheckoutContact | null
|
|
437
|
+
) => Promise<StripeCheckoutUpdateAddressResult>;
|
|
438
|
+
updateBillingAddress: (
|
|
439
|
+
billingAddress: StripeCheckoutContact | null
|
|
440
|
+
) => Promise<StripeCheckoutUpdateAddressResult>;
|
|
441
|
+
updatePhoneNumber: (
|
|
442
|
+
phoneNumber: string
|
|
443
|
+
) => Promise<StripeCheckoutUpdatePhoneNumberResult>;
|
|
444
|
+
updateEmail: (email: string) => Promise<StripeCheckoutUpdateEmailResult>;
|
|
445
|
+
updateLineItemQuantity: (args: {
|
|
446
|
+
lineItem: string;
|
|
447
|
+
quantity: number;
|
|
448
|
+
}) => Promise<StripeCheckoutUpdateLineItemQuantityResult>;
|
|
449
|
+
updateShippingOption: (
|
|
450
|
+
shippingOption: string
|
|
451
|
+
) => Promise<StripeCheckoutResult>;
|
|
452
|
+
confirm: (args?: {
|
|
453
|
+
returnUrl?: string;
|
|
454
|
+
redirect?: StripeCheckoutRedirectBehavior;
|
|
455
|
+
paymentMethod?: string;
|
|
456
|
+
savePaymentMethod?: boolean;
|
|
457
|
+
email?: string;
|
|
458
|
+
phoneNumber?: string;
|
|
459
|
+
billingAddress?: StripeCheckoutContact;
|
|
460
|
+
shippingAddress?: StripeCheckoutContact;
|
|
461
|
+
expressCheckoutConfirmEvent?: StripeExpressCheckoutElementConfirmEvent;
|
|
462
|
+
}) => Promise<StripeCheckoutConfirmResult>;
|
|
463
|
+
session: () => StripeCheckoutSession;
|
|
464
|
+
on: (event: 'change', handler: StripeCheckoutUpdateHandler) => void;
|
|
465
|
+
|
|
466
|
+
/* Elements methods */
|
|
467
|
+
changeAppearance: (appearance: Appearance) => void;
|
|
468
|
+
getElement(elementType: 'payment'): StripePaymentElement | null;
|
|
469
|
+
getElement(
|
|
470
|
+
elementType: 'address',
|
|
471
|
+
mode: AddressMode
|
|
472
|
+
): StripeAddressElement | null;
|
|
473
|
+
getElement(
|
|
474
|
+
elementType: 'expressCheckout'
|
|
475
|
+
): StripeCheckoutExpressCheckoutElement | null;
|
|
476
|
+
/* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */
|
|
477
|
+
getElement(
|
|
478
|
+
elementType: 'currencySelector'
|
|
479
|
+
): StripeCurrencySelectorElement | null;
|
|
480
|
+
createElement(
|
|
481
|
+
elementType: 'payment',
|
|
482
|
+
options?: StripeCheckoutPaymentElementOptions
|
|
483
|
+
): StripePaymentElement;
|
|
484
|
+
createElement(
|
|
485
|
+
elementType: 'address',
|
|
486
|
+
options: StripeCheckoutAddressElementOptions
|
|
487
|
+
): StripeAddressElement;
|
|
488
|
+
createElement(
|
|
489
|
+
elementType: 'expressCheckout',
|
|
490
|
+
options: StripeCheckoutExpressCheckoutElementOptions
|
|
491
|
+
): StripeCheckoutExpressCheckoutElement;
|
|
492
|
+
/* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */
|
|
493
|
+
createElement(elementType: 'currencySelector'): StripeCurrencySelectorElement;
|
|
494
|
+
}
|