@stripe/stripe-js 3.0.10 → 3.2.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/bank-accounts.d.mts +61 -0
- package/dist/api/bank-accounts.d.ts +61 -0
- package/dist/api/cards.d.mts +130 -0
- package/dist/api/cards.d.ts +130 -0
- package/dist/api/confirmation-tokens.d.mts +191 -0
- package/dist/api/confirmation-tokens.d.ts +191 -0
- package/dist/api/financial-connections.d.mts +232 -0
- package/dist/api/financial-connections.d.ts +232 -0
- package/dist/api/index.d.mts +12 -0
- package/dist/api/index.d.ts +12 -0
- package/dist/api/orders.d.mts +122 -0
- package/dist/api/orders.d.ts +122 -0
- package/dist/api/payment-intents.d.mts +330 -0
- package/dist/api/payment-intents.d.ts +330 -0
- package/dist/api/payment-methods.d.mts +452 -0
- package/dist/api/payment-methods.d.ts +452 -0
- package/dist/api/setup-intents.d.mts +184 -0
- package/dist/api/setup-intents.d.ts +184 -0
- package/dist/api/shared.d.mts +125 -0
- package/dist/api/shared.d.ts +125 -0
- package/dist/api/sources.d.mts +1045 -0
- package/dist/api/sources.d.ts +1045 -0
- package/dist/api/tokens.d.mts +639 -0
- package/dist/api/tokens.d.ts +639 -0
- package/dist/api/verification-sessions.d.mts +9 -0
- package/dist/api/verification-sessions.d.ts +9 -0
- package/dist/index.d.mts +4 -12792
- package/dist/index.d.ts +4 -12792
- package/dist/{stripe.js → index.js} +1 -1
- package/dist/{stripe.mjs → index.mjs} +1 -1
- package/dist/pure.d.mts +5 -0
- package/dist/pure.d.ts +5 -0
- package/dist/pure.js +204 -0
- package/dist/pure.mjs +200 -0
- package/dist/shared.d.mts +6 -0
- package/dist/shared.d.ts +6 -0
- package/dist/stripe-js/checkout.d.mts +153 -0
- package/dist/stripe-js/checkout.d.ts +153 -0
- package/dist/stripe-js/confirmation-tokens.d.mts +1 -0
- package/dist/stripe-js/confirmation-tokens.d.ts +1 -0
- package/dist/stripe-js/custom-checkout.d.mts +402 -0
- package/dist/stripe-js/custom-checkout.d.ts +402 -0
- package/dist/stripe-js/elements/address.d.mts +261 -0
- package/dist/stripe-js/elements/address.d.ts +261 -0
- package/dist/stripe-js/elements/affirm-message.d.mts +65 -0
- package/dist/stripe-js/elements/affirm-message.d.ts +65 -0
- package/dist/stripe-js/elements/afterpay-clearpay-message.d.mts +119 -0
- package/dist/stripe-js/elements/afterpay-clearpay-message.d.ts +119 -0
- package/dist/stripe-js/elements/apple-pay.d.mts +156 -0
- package/dist/stripe-js/elements/apple-pay.d.ts +156 -0
- package/dist/stripe-js/elements/au-bank-account.d.mts +138 -0
- package/dist/stripe-js/elements/au-bank-account.d.ts +138 -0
- package/dist/stripe-js/elements/base.d.mts +264 -0
- package/dist/stripe-js/elements/base.d.ts +264 -0
- package/dist/stripe-js/elements/card-cvc.d.mts +119 -0
- package/dist/stripe-js/elements/card-cvc.d.ts +119 -0
- package/dist/stripe-js/elements/card-expiry.d.mts +119 -0
- package/dist/stripe-js/elements/card-expiry.d.ts +119 -0
- package/dist/stripe-js/elements/card-number.d.mts +200 -0
- package/dist/stripe-js/elements/card-number.d.ts +200 -0
- package/dist/stripe-js/elements/card.d.mts +226 -0
- package/dist/stripe-js/elements/card.d.ts +226 -0
- package/dist/stripe-js/elements/cart.d.mts +224 -0
- package/dist/stripe-js/elements/cart.d.ts +224 -0
- package/dist/stripe-js/elements/eps-bank.d.mts +140 -0
- package/dist/stripe-js/elements/eps-bank.d.ts +140 -0
- package/dist/stripe-js/elements/express-checkout.d.mts +446 -0
- package/dist/stripe-js/elements/express-checkout.d.ts +446 -0
- package/dist/stripe-js/elements/fpx-bank.d.mts +134 -0
- package/dist/stripe-js/elements/fpx-bank.d.ts +134 -0
- package/dist/stripe-js/elements/iban.d.mts +135 -0
- package/dist/stripe-js/elements/iban.d.ts +135 -0
- package/dist/stripe-js/elements/ideal-bank.d.mts +140 -0
- package/dist/stripe-js/elements/ideal-bank.d.ts +140 -0
- package/dist/stripe-js/elements/index.d.mts +22 -0
- package/dist/stripe-js/elements/index.d.ts +22 -0
- package/dist/stripe-js/elements/issuing/index.d.mts +5 -0
- package/dist/stripe-js/elements/issuing/index.d.ts +5 -0
- package/dist/stripe-js/elements/issuing/issuing-card-copy-button.d.mts +37 -0
- package/dist/stripe-js/elements/issuing/issuing-card-copy-button.d.ts +37 -0
- package/dist/stripe-js/elements/issuing/issuing-card-cvc-display.d.mts +32 -0
- package/dist/stripe-js/elements/issuing/issuing-card-cvc-display.d.ts +32 -0
- package/dist/stripe-js/elements/issuing/issuing-card-expiry-display.d.mts +32 -0
- package/dist/stripe-js/elements/issuing/issuing-card-expiry-display.d.ts +32 -0
- package/dist/stripe-js/elements/issuing/issuing-card-number-display.d.mts +40 -0
- package/dist/stripe-js/elements/issuing/issuing-card-number-display.d.ts +40 -0
- package/dist/stripe-js/elements/issuing/issuing-card-pin-display.d.mts +32 -0
- package/dist/stripe-js/elements/issuing/issuing-card-pin-display.d.ts +32 -0
- package/dist/stripe-js/elements/link-authentication.d.mts +158 -0
- package/dist/stripe-js/elements/link-authentication.d.ts +158 -0
- package/dist/stripe-js/elements/p24-bank.d.mts +140 -0
- package/dist/stripe-js/elements/p24-bank.d.ts +140 -0
- package/dist/stripe-js/elements/payment-method-messaging.d.mts +98 -0
- package/dist/stripe-js/elements/payment-method-messaging.d.ts +98 -0
- package/dist/stripe-js/elements/payment-request-button.d.mts +151 -0
- package/dist/stripe-js/elements/payment-request-button.d.ts +151 -0
- package/dist/stripe-js/elements/payment.d.mts +275 -0
- package/dist/stripe-js/elements/payment.d.ts +275 -0
- package/dist/stripe-js/elements/shipping-address.d.mts +215 -0
- package/dist/stripe-js/elements/shipping-address.d.ts +215 -0
- package/dist/stripe-js/elements-group.d.mts +1143 -0
- package/dist/stripe-js/elements-group.d.ts +1143 -0
- package/dist/stripe-js/embedded-checkout.d.mts +35 -0
- package/dist/stripe-js/embedded-checkout.d.ts +35 -0
- package/dist/stripe-js/ephemeral-keys.d.mts +3 -0
- package/dist/stripe-js/ephemeral-keys.d.ts +3 -0
- package/dist/stripe-js/financial-connections.d.mts +19 -0
- package/dist/stripe-js/financial-connections.d.ts +19 -0
- package/dist/stripe-js/index.d.mts +13 -0
- package/dist/stripe-js/index.d.ts +13 -0
- package/dist/stripe-js/orders.d.mts +9 -0
- package/dist/stripe-js/orders.d.ts +9 -0
- package/dist/stripe-js/payment-intents.d.mts +1473 -0
- package/dist/stripe-js/payment-intents.d.ts +1473 -0
- package/dist/stripe-js/payment-request.d.mts +529 -0
- package/dist/stripe-js/payment-request.d.ts +529 -0
- package/dist/stripe-js/setup-intents.d.mts +250 -0
- package/dist/stripe-js/setup-intents.d.ts +250 -0
- package/dist/stripe-js/stripe.d.mts +1486 -0
- package/dist/stripe-js/stripe.d.ts +1486 -0
- package/dist/stripe-js/token-and-sources.d.mts +110 -0
- package/dist/stripe-js/token-and-sources.d.ts +110 -0
- package/dist/utils.d.mts +2 -0
- package/dist/utils.d.ts +2 -0
- package/lib/index.d.mts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -0
- package/lib/index.mjs +1 -0
- package/package.json +11 -10
- package/pure/index.d.mts +1 -12771
- package/pure/index.d.ts +1 -12771
- package/pure/index.js +1 -204
- package/pure/index.mjs +1 -200
|
@@ -0,0 +1,402 @@
|
|
|
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
|
+
StripeElementBase,
|
|
16
|
+
StripeExpressCheckoutElement,
|
|
17
|
+
StripeExpressCheckoutElementConfirmEvent,
|
|
18
|
+
StripeExpressCheckoutElementOptions,
|
|
19
|
+
StripeExpressCheckoutElementReadyEvent,
|
|
20
|
+
} from './elements';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Requires beta access:
|
|
24
|
+
* Contact [Stripe support](https://support.stripe.com/) for more information.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export interface StripeCustomCheckoutElementsOptions {
|
|
28
|
+
appearance?: Appearance;
|
|
29
|
+
loader?: 'auto' | 'always' | 'never';
|
|
30
|
+
fonts?: Array<CssFontSource | CustomFontSource>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface StripeCustomCheckoutOptions {
|
|
34
|
+
clientSecret: string;
|
|
35
|
+
elementsOptions?: StripeCustomCheckoutElementsOptions;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* Custom Checkout types */
|
|
39
|
+
export type StripeCustomCheckoutAddress = {
|
|
40
|
+
country: string;
|
|
41
|
+
line1?: string | null;
|
|
42
|
+
line2?: string | null;
|
|
43
|
+
city?: string | null;
|
|
44
|
+
postal_code?: string | null;
|
|
45
|
+
state?: string | null;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type StripeCustomCheckoutAdjustableQuantity = {
|
|
49
|
+
maximum: number;
|
|
50
|
+
minimum: number;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type StripeCustomCheckoutBillingInterval =
|
|
54
|
+
| 'day'
|
|
55
|
+
| 'month'
|
|
56
|
+
| 'week'
|
|
57
|
+
| 'year';
|
|
58
|
+
|
|
59
|
+
export type StripeCustomCheckoutConfirmationRequirement =
|
|
60
|
+
| 'phoneNumber'
|
|
61
|
+
| 'shippingAddress'
|
|
62
|
+
| 'billingAddress'
|
|
63
|
+
| 'paymentDetails'
|
|
64
|
+
| 'email';
|
|
65
|
+
|
|
66
|
+
export type StripeCustomCheckoutContact = {
|
|
67
|
+
name?: string | null;
|
|
68
|
+
address: StripeCustomCheckoutAddress;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export type StripeCustomCheckoutDeliveryEstimate = {
|
|
72
|
+
maximum: StripeCustomCheckoutEstimate | null;
|
|
73
|
+
minimum: StripeCustomCheckoutEstimate | null;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export type StripeCustomCheckoutDiscountAmount = {
|
|
77
|
+
amount: number;
|
|
78
|
+
displayName: string;
|
|
79
|
+
promotionCode: string | null;
|
|
80
|
+
recurring:
|
|
81
|
+
| {type: 'forever'}
|
|
82
|
+
| {type: 'repeating'; durationInMonths: number}
|
|
83
|
+
| null;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export type StripeCustomCheckoutDueNext = {
|
|
87
|
+
amountSubtotal: number;
|
|
88
|
+
amountDiscount: number;
|
|
89
|
+
amountTaxInclusive: number;
|
|
90
|
+
amountTaxExclusive: number;
|
|
91
|
+
billingCycleAnchor: number | null;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export type StripeCustomCheckoutEstimate = {
|
|
95
|
+
unit: 'business_day' | 'day' | 'hour' | 'week' | 'month';
|
|
96
|
+
value: number;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export type StripeCustomCheckoutLastPaymentError = {
|
|
100
|
+
message: string;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export type StripeCustomCheckoutTaxAmount = {
|
|
104
|
+
amount: number;
|
|
105
|
+
inclusive: boolean;
|
|
106
|
+
displayName: string;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export type StripeCustomCheckoutLineItem = {
|
|
110
|
+
id: string;
|
|
111
|
+
name: string;
|
|
112
|
+
amountDiscount: number;
|
|
113
|
+
amountSubtotal: number;
|
|
114
|
+
amountTaxExclusive: number;
|
|
115
|
+
amountTaxInclusive: number;
|
|
116
|
+
unitAmount: number;
|
|
117
|
+
description: string | null;
|
|
118
|
+
quantity: number;
|
|
119
|
+
discountAmounts: Array<StripeCustomCheckoutDiscountAmount> | null;
|
|
120
|
+
taxAmounts: Array<StripeCustomCheckoutTaxAmount> | null;
|
|
121
|
+
recurring: {
|
|
122
|
+
interval: StripeCustomCheckoutBillingInterval;
|
|
123
|
+
intervalCount: number;
|
|
124
|
+
isProrated: boolean;
|
|
125
|
+
usageType: 'metered' | 'licensed';
|
|
126
|
+
} | null;
|
|
127
|
+
adjustableQuantity: StripeCustomCheckoutAdjustableQuantity | null;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export type StripeCustomCheckoutRecurring = {
|
|
131
|
+
interval: StripeCustomCheckoutBillingInterval;
|
|
132
|
+
intervalCount: number;
|
|
133
|
+
dueNext: StripeCustomCheckoutDueNext;
|
|
134
|
+
trial: StripeCustomCheckoutTrial | null;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export type StripeCustomCheckoutShipping = {
|
|
138
|
+
shippingOption: StripeCustomCheckoutShippingOption;
|
|
139
|
+
taxAmounts: Array<StripeCustomCheckoutTaxAmount> | null;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export type StripeCustomCheckoutShippingOption = {
|
|
143
|
+
id: string;
|
|
144
|
+
amount: number;
|
|
145
|
+
currency: string;
|
|
146
|
+
displayName: string | null;
|
|
147
|
+
deliveryEstimate: StripeCustomCheckoutDeliveryEstimate | null;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export type StripeCustomCheckoutStatus =
|
|
151
|
+
| {type: 'open'}
|
|
152
|
+
| {type: 'expired'}
|
|
153
|
+
| {
|
|
154
|
+
type: 'complete';
|
|
155
|
+
paymentStatus: 'paid' | 'unpaid' | 'no_payment_required';
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export type StripeCustomCheckoutTaxStatus =
|
|
159
|
+
| {status: 'ready'}
|
|
160
|
+
| {status: 'requires_shipping_address'}
|
|
161
|
+
| {status: 'requires_billing_address'};
|
|
162
|
+
|
|
163
|
+
export type StripeCustomCheckoutTotalSummary = {
|
|
164
|
+
appliedBalance: number;
|
|
165
|
+
balanceAppliedToNextInvoice: boolean;
|
|
166
|
+
discount: number;
|
|
167
|
+
shippingRate: number;
|
|
168
|
+
subtotal: number;
|
|
169
|
+
taxExclusive: number;
|
|
170
|
+
taxInclusive: number;
|
|
171
|
+
total: number;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export type StripeCustomCheckoutTrial = {
|
|
175
|
+
trialEnd: number;
|
|
176
|
+
trialPeriodDays: number;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/* Custom Checkout session */
|
|
180
|
+
export interface StripeCustomCheckoutSession {
|
|
181
|
+
billingAddress: StripeCustomCheckoutContact | null;
|
|
182
|
+
canConfirm: boolean;
|
|
183
|
+
confirmationRequirements: StripeCustomCheckoutConfirmationRequirement[];
|
|
184
|
+
currency: string;
|
|
185
|
+
discountAmounts: Array<StripeCustomCheckoutDiscountAmount> | null;
|
|
186
|
+
email: string | null;
|
|
187
|
+
lastPaymentError: StripeCustomCheckoutLastPaymentError | null;
|
|
188
|
+
lineItems: Array<StripeCustomCheckoutLineItem>;
|
|
189
|
+
phoneNumber: string | null;
|
|
190
|
+
recurring: StripeCustomCheckoutRecurring | null;
|
|
191
|
+
shipping: StripeCustomCheckoutShipping | null;
|
|
192
|
+
shippingAddress: StripeCustomCheckoutContact | null;
|
|
193
|
+
shippingOptions: Array<StripeCustomCheckoutShippingOption>;
|
|
194
|
+
status: StripeCustomCheckoutStatus;
|
|
195
|
+
tax: StripeCustomCheckoutTaxStatus;
|
|
196
|
+
taxAmounts: Array<StripeCustomCheckoutTaxAmount> | null;
|
|
197
|
+
total: StripeCustomCheckoutTotalSummary;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export type StripeCustomCheckoutResult =
|
|
201
|
+
| {session: StripeCustomCheckoutSession; error?: undefined}
|
|
202
|
+
| {session?: undefined; error: StripeError};
|
|
203
|
+
|
|
204
|
+
export type StripeCustomCheckoutPaymentElementOptions = {
|
|
205
|
+
layout?: Layout | LayoutObject;
|
|
206
|
+
paymentMethodOrder?: Array<string>;
|
|
207
|
+
readonly?: boolean;
|
|
208
|
+
terms?: TermsOption;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export type StripeCustomCheckoutAddressElementOptions = {
|
|
212
|
+
mode: AddressMode;
|
|
213
|
+
contacts?: ContactOption[];
|
|
214
|
+
display?: {
|
|
215
|
+
name?: 'full' | 'split' | 'organization';
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export type StripeCustomCheckoutExpressCheckoutElementOptions = {
|
|
220
|
+
buttonHeight: StripeExpressCheckoutElementOptions['buttonHeight'];
|
|
221
|
+
buttonTheme: StripeExpressCheckoutElementOptions['buttonTheme'];
|
|
222
|
+
buttonType: StripeExpressCheckoutElementOptions['buttonType'];
|
|
223
|
+
layout: StripeExpressCheckoutElementOptions['layout'];
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
export type StripeCustomCheckoutUpdateHandler = (
|
|
227
|
+
session: StripeCustomCheckoutSession
|
|
228
|
+
) => void;
|
|
229
|
+
|
|
230
|
+
export type StripeCustomCheckoutExpressCheckoutElementConfirmEvent = StripeExpressCheckoutElementConfirmEvent & {
|
|
231
|
+
confirm: () => Promise<StripeCustomCheckoutResult>;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export type StripeCustomCheckoutExpressCheckoutElement = StripeElementBase & {
|
|
235
|
+
/**
|
|
236
|
+
* Triggered when the element is fully rendered.
|
|
237
|
+
*/
|
|
238
|
+
on(
|
|
239
|
+
eventType: 'ready',
|
|
240
|
+
handler: (event: StripeExpressCheckoutElementReadyEvent) => any
|
|
241
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
242
|
+
once(
|
|
243
|
+
eventType: 'ready',
|
|
244
|
+
handler: (event: StripeExpressCheckoutElementReadyEvent) => any
|
|
245
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
246
|
+
off(
|
|
247
|
+
eventType: 'ready',
|
|
248
|
+
handler?: (event: StripeExpressCheckoutElementReadyEvent) => any
|
|
249
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Triggered when the element gains focus.
|
|
253
|
+
*/
|
|
254
|
+
on(
|
|
255
|
+
eventType: 'focus',
|
|
256
|
+
handler: (event: {elementType: 'expressCheckout'}) => any
|
|
257
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
258
|
+
once(
|
|
259
|
+
eventType: 'focus',
|
|
260
|
+
handler: (event: {elementType: 'expressCheckout'}) => any
|
|
261
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
262
|
+
off(
|
|
263
|
+
eventType: 'focus',
|
|
264
|
+
handler?: (event: {elementType: 'expressCheckout'}) => any
|
|
265
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Triggered when the element loses focus.
|
|
269
|
+
*/
|
|
270
|
+
on(
|
|
271
|
+
eventType: 'blur',
|
|
272
|
+
handler: (event: {elementType: 'expressCheckout'}) => any
|
|
273
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
274
|
+
once(
|
|
275
|
+
eventType: 'blur',
|
|
276
|
+
handler: (event: {elementType: 'expressCheckout'}) => any
|
|
277
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
278
|
+
off(
|
|
279
|
+
eventType: 'blur',
|
|
280
|
+
handler?: (event: {elementType: 'expressCheckout'}) => any
|
|
281
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Triggered when the escape key is pressed within the element.
|
|
285
|
+
*/
|
|
286
|
+
on(
|
|
287
|
+
eventType: 'escape',
|
|
288
|
+
handler: (event: {elementType: 'expressCheckout'}) => any
|
|
289
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
290
|
+
once(
|
|
291
|
+
eventType: 'escape',
|
|
292
|
+
handler: (event: {elementType: 'expressCheckout'}) => any
|
|
293
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
294
|
+
off(
|
|
295
|
+
eventType: 'escape',
|
|
296
|
+
handler?: (event: {elementType: 'expressCheckout'}) => any
|
|
297
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Triggered when the element fails to load.
|
|
301
|
+
*/
|
|
302
|
+
on(
|
|
303
|
+
eventType: 'loaderror',
|
|
304
|
+
handler: (event: {
|
|
305
|
+
elementType: 'expressCheckout';
|
|
306
|
+
error: StripeError;
|
|
307
|
+
}) => any
|
|
308
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
309
|
+
once(
|
|
310
|
+
eventType: 'loaderror',
|
|
311
|
+
handler: (event: {
|
|
312
|
+
elementType: 'expressCheckout';
|
|
313
|
+
error: StripeError;
|
|
314
|
+
}) => any
|
|
315
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
316
|
+
off(
|
|
317
|
+
eventType: 'loaderror',
|
|
318
|
+
handler?: (event: {
|
|
319
|
+
elementType: 'expressCheckout';
|
|
320
|
+
error: StripeError;
|
|
321
|
+
}) => any
|
|
322
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Triggered when a buyer authorizes a payment within a supported payment method.
|
|
326
|
+
*/
|
|
327
|
+
on(
|
|
328
|
+
eventType: 'confirm',
|
|
329
|
+
handler: (
|
|
330
|
+
event: StripeCustomCheckoutExpressCheckoutElementConfirmEvent
|
|
331
|
+
) => any
|
|
332
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
333
|
+
once(
|
|
334
|
+
eventType: 'confirm',
|
|
335
|
+
handler: (
|
|
336
|
+
event: StripeCustomCheckoutExpressCheckoutElementConfirmEvent
|
|
337
|
+
) => any
|
|
338
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
339
|
+
off(
|
|
340
|
+
eventType: 'confirm',
|
|
341
|
+
handler?: (
|
|
342
|
+
event: StripeCustomCheckoutExpressCheckoutElementConfirmEvent
|
|
343
|
+
) => any
|
|
344
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Updates the options the `ExpressCheckoutElement` was initialized with.
|
|
348
|
+
* Updates are merged into the existing configuration.
|
|
349
|
+
*/
|
|
350
|
+
update: StripeExpressCheckoutElement['update'];
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
export interface StripeCustomCheckout {
|
|
354
|
+
/* Custom Checkout methods */
|
|
355
|
+
applyPromotionCode: (
|
|
356
|
+
promotionCode: string
|
|
357
|
+
) => Promise<StripeCustomCheckoutResult>;
|
|
358
|
+
removePromotionCode: () => Promise<StripeCustomCheckoutResult>;
|
|
359
|
+
updateShippingAddress: (
|
|
360
|
+
shippingAddress: StripeCustomCheckoutContact | null
|
|
361
|
+
) => Promise<StripeCustomCheckoutResult>;
|
|
362
|
+
updateBillingAddress: (
|
|
363
|
+
billingAddress: StripeCustomCheckoutContact | null
|
|
364
|
+
) => Promise<StripeCustomCheckoutResult>;
|
|
365
|
+
updatePhoneNumber: (phoneNumber: string) => void;
|
|
366
|
+
updateEmail: (email: string) => void;
|
|
367
|
+
updateLineItemQuantity: (args: {
|
|
368
|
+
lineItem: string;
|
|
369
|
+
quantity: number;
|
|
370
|
+
}) => Promise<StripeCustomCheckoutResult>;
|
|
371
|
+
updateShippingOption: (
|
|
372
|
+
shippingOption: string
|
|
373
|
+
) => Promise<StripeCustomCheckoutResult>;
|
|
374
|
+
confirm: (args?: {
|
|
375
|
+
return_url?: string;
|
|
376
|
+
}) => Promise<StripeCustomCheckoutResult>;
|
|
377
|
+
session: () => StripeCustomCheckoutSession;
|
|
378
|
+
on: (event: 'change', handler: StripeCustomCheckoutUpdateHandler) => void;
|
|
379
|
+
|
|
380
|
+
/* Elements methods */
|
|
381
|
+
changeAppearance: (appearance: Appearance) => void;
|
|
382
|
+
getElement(elementType: 'payment'): StripePaymentElement | null;
|
|
383
|
+
getElement(
|
|
384
|
+
elementType: 'address',
|
|
385
|
+
mode: AddressMode
|
|
386
|
+
): StripeAddressElement | null;
|
|
387
|
+
getElement(
|
|
388
|
+
elementType: 'expressCheckout'
|
|
389
|
+
): StripeCustomCheckoutExpressCheckoutElement | null;
|
|
390
|
+
createElement(
|
|
391
|
+
elementType: 'payment',
|
|
392
|
+
options?: StripeCustomCheckoutPaymentElementOptions
|
|
393
|
+
): StripePaymentElement;
|
|
394
|
+
createElement(
|
|
395
|
+
elementType: 'address',
|
|
396
|
+
options: StripeCustomCheckoutAddressElementOptions
|
|
397
|
+
): StripeAddressElement;
|
|
398
|
+
createElement(
|
|
399
|
+
elementType: 'expressCheckout',
|
|
400
|
+
options: StripeCustomCheckoutExpressCheckoutElementOptions
|
|
401
|
+
): StripeCustomCheckoutExpressCheckoutElement;
|
|
402
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import {StripeElementBase} from './base';
|
|
2
|
+
import {StripeError} from '../stripe';
|
|
3
|
+
|
|
4
|
+
export type StripeAddressElement = StripeElementBase & {
|
|
5
|
+
/**
|
|
6
|
+
* The change event is triggered when the `Element`'s value changes.
|
|
7
|
+
*/
|
|
8
|
+
on(
|
|
9
|
+
eventType: 'change',
|
|
10
|
+
handler: (event: StripeAddressElementChangeEvent) => any
|
|
11
|
+
): StripeAddressElement;
|
|
12
|
+
once(
|
|
13
|
+
eventType: 'change',
|
|
14
|
+
handler: (event: StripeAddressElementChangeEvent) => any
|
|
15
|
+
): StripeAddressElement;
|
|
16
|
+
off(
|
|
17
|
+
eventType: 'change',
|
|
18
|
+
handler?: (event: StripeAddressElementChangeEvent) => any
|
|
19
|
+
): StripeAddressElement;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Triggered when the element is fully rendered and can accept `element.focus` calls.
|
|
23
|
+
*/
|
|
24
|
+
on(
|
|
25
|
+
eventType: 'ready',
|
|
26
|
+
handler: (event: {elementType: 'address'}) => any
|
|
27
|
+
): StripeAddressElement;
|
|
28
|
+
once(
|
|
29
|
+
eventType: 'ready',
|
|
30
|
+
handler: (event: {elementType: 'address'}) => any
|
|
31
|
+
): StripeAddressElement;
|
|
32
|
+
off(
|
|
33
|
+
eventType: 'ready',
|
|
34
|
+
handler?: (event: {elementType: 'address'}) => any
|
|
35
|
+
): StripeAddressElement;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Triggered when the element gains focus.
|
|
39
|
+
*/
|
|
40
|
+
on(
|
|
41
|
+
eventType: 'focus',
|
|
42
|
+
handler: (event: {elementType: 'address'}) => any
|
|
43
|
+
): StripeAddressElement;
|
|
44
|
+
once(
|
|
45
|
+
eventType: 'focus',
|
|
46
|
+
handler: (event: {elementType: 'address'}) => any
|
|
47
|
+
): StripeAddressElement;
|
|
48
|
+
off(
|
|
49
|
+
eventType: 'focus',
|
|
50
|
+
handler?: (event: {elementType: 'address'}) => any
|
|
51
|
+
): StripeAddressElement;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Triggered when the element loses focus.
|
|
55
|
+
*/
|
|
56
|
+
on(
|
|
57
|
+
eventType: 'blur',
|
|
58
|
+
handler: (event: {elementType: 'address'}) => any
|
|
59
|
+
): StripeAddressElement;
|
|
60
|
+
once(
|
|
61
|
+
eventType: 'blur',
|
|
62
|
+
handler: (event: {elementType: 'address'}) => any
|
|
63
|
+
): StripeAddressElement;
|
|
64
|
+
off(
|
|
65
|
+
eventType: 'blur',
|
|
66
|
+
handler?: (event: {elementType: 'address'}) => any
|
|
67
|
+
): StripeAddressElement;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Triggered when the escape key is pressed within the element.
|
|
71
|
+
*/
|
|
72
|
+
on(
|
|
73
|
+
eventType: 'escape',
|
|
74
|
+
handler: (event: {elementType: 'address'}) => any
|
|
75
|
+
): StripeAddressElement;
|
|
76
|
+
once(
|
|
77
|
+
eventType: 'escape',
|
|
78
|
+
handler: (event: {elementType: 'address'}) => any
|
|
79
|
+
): StripeAddressElement;
|
|
80
|
+
off(
|
|
81
|
+
eventType: 'escape',
|
|
82
|
+
handler?: (event: {elementType: 'address'}) => any
|
|
83
|
+
): StripeAddressElement;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Triggered when the element fails to load.
|
|
87
|
+
*/
|
|
88
|
+
on(
|
|
89
|
+
eventType: 'loaderror',
|
|
90
|
+
handler: (event: {elementType: 'address'; error: StripeError}) => any
|
|
91
|
+
): StripeAddressElement;
|
|
92
|
+
once(
|
|
93
|
+
eventType: 'loaderror',
|
|
94
|
+
handler: (event: {elementType: 'address'; error: StripeError}) => any
|
|
95
|
+
): StripeAddressElement;
|
|
96
|
+
off(
|
|
97
|
+
eventType: 'loaderror',
|
|
98
|
+
handler?: (event: {elementType: 'address'; error: StripeError}) => any
|
|
99
|
+
): StripeAddressElement;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Triggered when the loader UI is mounted to the DOM and ready to be displayed.
|
|
103
|
+
*/
|
|
104
|
+
on(
|
|
105
|
+
eventType: 'loaderstart',
|
|
106
|
+
handler: (event: {elementType: 'address'}) => any
|
|
107
|
+
): StripeAddressElement;
|
|
108
|
+
once(
|
|
109
|
+
eventType: 'loaderstart',
|
|
110
|
+
handler: (event: {elementType: 'address'}) => any
|
|
111
|
+
): StripeAddressElement;
|
|
112
|
+
off(
|
|
113
|
+
eventType: 'loaderstart',
|
|
114
|
+
handler?: (event: {elementType: 'address'}) => any
|
|
115
|
+
): StripeAddressElement;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Updates the options the `AddressElement` was initialized with.
|
|
119
|
+
* Updates are merged into the existing configuration.
|
|
120
|
+
*/
|
|
121
|
+
update(options: Partial<StripeAddressElementOptions>): StripeAddressElement;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Validates and retrieves form values from the `AddressElement`.
|
|
125
|
+
*/
|
|
126
|
+
getValue(): Promise<
|
|
127
|
+
Pick<StripeAddressElementChangeEvent, 'complete' | 'isNewAddress' | 'value'>
|
|
128
|
+
>;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export interface ContactOption {
|
|
132
|
+
name: string;
|
|
133
|
+
phone?: string;
|
|
134
|
+
address: {
|
|
135
|
+
line1: string;
|
|
136
|
+
line2?: string;
|
|
137
|
+
city: string;
|
|
138
|
+
state: string;
|
|
139
|
+
postal_code: string;
|
|
140
|
+
country: string;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export type AddressMode = 'shipping' | 'billing';
|
|
145
|
+
|
|
146
|
+
export interface StripeAddressElementOptions {
|
|
147
|
+
/**
|
|
148
|
+
* Control which mode the AddressElement will be used for.
|
|
149
|
+
*/
|
|
150
|
+
mode: AddressMode;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* An array of two-letter ISO country codes representing which countries
|
|
154
|
+
* are displayed in the AddressElement.
|
|
155
|
+
*/
|
|
156
|
+
allowedCountries?: string[] | null;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Control autocomplete settings in the AddressElement.
|
|
160
|
+
*/
|
|
161
|
+
autocomplete?:
|
|
162
|
+
| {mode: 'automatic'}
|
|
163
|
+
| {mode: 'disabled'}
|
|
164
|
+
| {mode: 'google_maps_api'; apiKey: string};
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Whether or not AddressElement accepts PO boxes
|
|
168
|
+
*/
|
|
169
|
+
blockPoBox?: boolean;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* An array of saved addresses.
|
|
173
|
+
*/
|
|
174
|
+
contacts?: ContactOption[];
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Default value for AddressElement fields
|
|
178
|
+
*/
|
|
179
|
+
defaultValues?: {
|
|
180
|
+
name?: string | null;
|
|
181
|
+
firstName?: string | null;
|
|
182
|
+
lastName?: string | null;
|
|
183
|
+
address?: {
|
|
184
|
+
line1?: string | null;
|
|
185
|
+
line2?: string | null;
|
|
186
|
+
city?: string | null;
|
|
187
|
+
state?: string | null;
|
|
188
|
+
postal_code?: string | null;
|
|
189
|
+
country: string;
|
|
190
|
+
};
|
|
191
|
+
phone?: string | null;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Control which additional fields to display in the AddressElement.
|
|
196
|
+
*/
|
|
197
|
+
fields?: {
|
|
198
|
+
phone?: 'always' | 'never' | 'auto';
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Specify validation rules for the above additional fields.
|
|
203
|
+
*/
|
|
204
|
+
validation?: {
|
|
205
|
+
phone?: {
|
|
206
|
+
required: 'always' | 'never' | 'auto';
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Specify display options in the AddressElement
|
|
212
|
+
*/
|
|
213
|
+
display?: {
|
|
214
|
+
name?: 'full' | 'split' | 'organization';
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export interface StripeAddressElementChangeEvent {
|
|
219
|
+
/**
|
|
220
|
+
* The type of element that emitted this event.
|
|
221
|
+
*/
|
|
222
|
+
elementType: 'address';
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* The mode of the AddressElement that emitted this event.
|
|
226
|
+
*/
|
|
227
|
+
elementMode: AddressMode;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Whether or not the AddressElement is currently empty.
|
|
231
|
+
*/
|
|
232
|
+
empty: boolean;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Whether or not the AddressElement is complete.
|
|
236
|
+
*/
|
|
237
|
+
complete: boolean;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Whether or not the address is new.
|
|
241
|
+
*/
|
|
242
|
+
isNewAddress: boolean;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* An object containing the current address.
|
|
246
|
+
*/
|
|
247
|
+
value: {
|
|
248
|
+
name: string;
|
|
249
|
+
firstName?: string;
|
|
250
|
+
lastName?: string;
|
|
251
|
+
address: {
|
|
252
|
+
line1: string;
|
|
253
|
+
line2: string | null;
|
|
254
|
+
city: string;
|
|
255
|
+
state: string;
|
|
256
|
+
postal_code: string;
|
|
257
|
+
country: string;
|
|
258
|
+
};
|
|
259
|
+
phone?: string;
|
|
260
|
+
};
|
|
261
|
+
}
|