@stripe/stripe-js 8.6.3 → 8.6.4
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/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/pure.js +2 -2
- package/dist/pure.mjs +2 -2
- package/dist/stripe-js/checkout.d.mts +38 -1
- package/dist/stripe-js/checkout.d.ts +38 -1
- package/dist/stripe-js/elements/index.d.mts +0 -1
- package/dist/stripe-js/elements/index.d.ts +0 -1
- package/dist/stripe-js/elements/payment-form.d.mts +204 -0
- package/dist/stripe-js/elements/payment-form.d.ts +204 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -71,7 +71,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
|
|
|
71
71
|
|
|
72
72
|
stripe._registerWrapper({
|
|
73
73
|
name: 'stripe-js',
|
|
74
|
-
version: "8.6.
|
|
74
|
+
version: "8.6.4",
|
|
75
75
|
startTime: startTime
|
|
76
76
|
});
|
|
77
77
|
};
|
|
@@ -172,7 +172,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
|
|
|
172
172
|
var expectedVersion = RELEASE_TRAIN;
|
|
173
173
|
|
|
174
174
|
if (isTestKey && version !== expectedVersion) {
|
|
175
|
-
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.6.
|
|
175
|
+
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.6.4", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
var stripe = maybeStripe.apply(undefined, args);
|
package/dist/index.mjs
CHANGED
|
@@ -67,7 +67,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
|
|
|
67
67
|
|
|
68
68
|
stripe._registerWrapper({
|
|
69
69
|
name: 'stripe-js',
|
|
70
|
-
version: "8.6.
|
|
70
|
+
version: "8.6.4",
|
|
71
71
|
startTime: startTime
|
|
72
72
|
});
|
|
73
73
|
};
|
|
@@ -168,7 +168,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
|
|
|
168
168
|
var expectedVersion = RELEASE_TRAIN;
|
|
169
169
|
|
|
170
170
|
if (isTestKey && version !== expectedVersion) {
|
|
171
|
-
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.6.
|
|
171
|
+
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.6.4", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
var stripe = maybeStripe.apply(undefined, args);
|
package/dist/pure.js
CHANGED
|
@@ -71,7 +71,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
|
|
|
71
71
|
|
|
72
72
|
stripe._registerWrapper({
|
|
73
73
|
name: 'stripe-js',
|
|
74
|
-
version: "8.6.
|
|
74
|
+
version: "8.6.4",
|
|
75
75
|
startTime: startTime
|
|
76
76
|
});
|
|
77
77
|
};
|
|
@@ -172,7 +172,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
|
|
|
172
172
|
var expectedVersion = RELEASE_TRAIN;
|
|
173
173
|
|
|
174
174
|
if (isTestKey && version !== expectedVersion) {
|
|
175
|
-
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.6.
|
|
175
|
+
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.6.4", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
var stripe = maybeStripe.apply(undefined, args);
|
package/dist/pure.mjs
CHANGED
|
@@ -67,7 +67,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
|
|
|
67
67
|
|
|
68
68
|
stripe._registerWrapper({
|
|
69
69
|
name: 'stripe-js',
|
|
70
|
-
version: "8.6.
|
|
70
|
+
version: "8.6.4",
|
|
71
71
|
startTime: startTime
|
|
72
72
|
});
|
|
73
73
|
};
|
|
@@ -168,7 +168,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
|
|
|
168
168
|
var expectedVersion = RELEASE_TRAIN;
|
|
169
169
|
|
|
170
170
|
if (isTestKey && version !== expectedVersion) {
|
|
171
|
-
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.6.
|
|
171
|
+
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.6.4", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
var stripe = maybeStripe.apply(undefined, args);
|
|
@@ -36,9 +36,12 @@ export interface StripeCheckoutElementsOptions {
|
|
|
36
36
|
export interface StripeCheckoutOptions {
|
|
37
37
|
clientSecret: Promise<string> | string;
|
|
38
38
|
elementsOptions?: StripeCheckoutElementsOptions;
|
|
39
|
+
adaptivePricing?: {allowed?: boolean};
|
|
39
40
|
defaultValues?: {
|
|
40
41
|
billingAddress?: StripeCheckoutContact;
|
|
41
42
|
shippingAddress?: StripeCheckoutContact;
|
|
43
|
+
email?: string;
|
|
44
|
+
phoneNumber?: string;
|
|
42
45
|
};
|
|
43
46
|
}
|
|
44
47
|
|
|
@@ -361,6 +364,38 @@ export type StripeCheckoutAddressElementOptions = {
|
|
|
361
364
|
};
|
|
362
365
|
};
|
|
363
366
|
|
|
367
|
+
/**
|
|
368
|
+
* Wallet button theme options for PaymentFormElement.
|
|
369
|
+
*/
|
|
370
|
+
export type PaymentFormWalletButtonTheme = {
|
|
371
|
+
applePay?: 'black' | 'white' | 'white-outline';
|
|
372
|
+
googlePay?: 'black' | 'white';
|
|
373
|
+
paypal?: 'gold' | 'blue' | 'silver' | 'white' | 'black';
|
|
374
|
+
klarna?: 'dark' | 'light' | 'outlined';
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
export type StripeCheckoutPaymentFormElementOptions = {
|
|
378
|
+
/**
|
|
379
|
+
* The layout of the PaymentFormElement.
|
|
380
|
+
*/
|
|
381
|
+
layout?: 'expanded' | 'compact';
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* An array of saved addresses to display in the PaymentFormElement.
|
|
385
|
+
*/
|
|
386
|
+
contacts?: ContactOption[];
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Wallet configuration options.
|
|
390
|
+
*/
|
|
391
|
+
wallets?: {
|
|
392
|
+
/**
|
|
393
|
+
* Button theme options for wallet payment methods.
|
|
394
|
+
*/
|
|
395
|
+
buttonTheme?: PaymentFormWalletButtonTheme;
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
|
|
364
399
|
export type StripeCheckoutExpressCheckoutElementOptions = {
|
|
365
400
|
buttonHeight: StripeExpressCheckoutElementOptions['buttonHeight'];
|
|
366
401
|
buttonTheme: StripeExpressCheckoutElementOptions['buttonTheme'];
|
|
@@ -634,7 +669,9 @@ export interface StripeCheckout {
|
|
|
634
669
|
options?: StripeCheckoutPaymentElementOptions
|
|
635
670
|
): StripePaymentElement;
|
|
636
671
|
/* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */
|
|
637
|
-
createPaymentFormElement(
|
|
672
|
+
createPaymentFormElement(
|
|
673
|
+
options?: StripeCheckoutPaymentFormElementOptions
|
|
674
|
+
): StripePaymentFormElement;
|
|
638
675
|
createBillingAddressElement(
|
|
639
676
|
options?: StripeCheckoutAddressElementOptions
|
|
640
677
|
): StripeAddressElement;
|
|
@@ -36,9 +36,12 @@ export interface StripeCheckoutElementsOptions {
|
|
|
36
36
|
export interface StripeCheckoutOptions {
|
|
37
37
|
clientSecret: Promise<string> | string;
|
|
38
38
|
elementsOptions?: StripeCheckoutElementsOptions;
|
|
39
|
+
adaptivePricing?: {allowed?: boolean};
|
|
39
40
|
defaultValues?: {
|
|
40
41
|
billingAddress?: StripeCheckoutContact;
|
|
41
42
|
shippingAddress?: StripeCheckoutContact;
|
|
43
|
+
email?: string;
|
|
44
|
+
phoneNumber?: string;
|
|
42
45
|
};
|
|
43
46
|
}
|
|
44
47
|
|
|
@@ -361,6 +364,38 @@ export type StripeCheckoutAddressElementOptions = {
|
|
|
361
364
|
};
|
|
362
365
|
};
|
|
363
366
|
|
|
367
|
+
/**
|
|
368
|
+
* Wallet button theme options for PaymentFormElement.
|
|
369
|
+
*/
|
|
370
|
+
export type PaymentFormWalletButtonTheme = {
|
|
371
|
+
applePay?: 'black' | 'white' | 'white-outline';
|
|
372
|
+
googlePay?: 'black' | 'white';
|
|
373
|
+
paypal?: 'gold' | 'blue' | 'silver' | 'white' | 'black';
|
|
374
|
+
klarna?: 'dark' | 'light' | 'outlined';
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
export type StripeCheckoutPaymentFormElementOptions = {
|
|
378
|
+
/**
|
|
379
|
+
* The layout of the PaymentFormElement.
|
|
380
|
+
*/
|
|
381
|
+
layout?: 'expanded' | 'compact';
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* An array of saved addresses to display in the PaymentFormElement.
|
|
385
|
+
*/
|
|
386
|
+
contacts?: ContactOption[];
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Wallet configuration options.
|
|
390
|
+
*/
|
|
391
|
+
wallets?: {
|
|
392
|
+
/**
|
|
393
|
+
* Button theme options for wallet payment methods.
|
|
394
|
+
*/
|
|
395
|
+
buttonTheme?: PaymentFormWalletButtonTheme;
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
|
|
364
399
|
export type StripeCheckoutExpressCheckoutElementOptions = {
|
|
365
400
|
buttonHeight: StripeExpressCheckoutElementOptions['buttonHeight'];
|
|
366
401
|
buttonTheme: StripeExpressCheckoutElementOptions['buttonTheme'];
|
|
@@ -634,7 +669,9 @@ export interface StripeCheckout {
|
|
|
634
669
|
options?: StripeCheckoutPaymentElementOptions
|
|
635
670
|
): StripePaymentElement;
|
|
636
671
|
/* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */
|
|
637
|
-
createPaymentFormElement(
|
|
672
|
+
createPaymentFormElement(
|
|
673
|
+
options?: StripeCheckoutPaymentFormElementOptions
|
|
674
|
+
): StripePaymentFormElement;
|
|
638
675
|
createBillingAddressElement(
|
|
639
676
|
options?: StripeCheckoutAddressElementOptions
|
|
640
677
|
): StripeAddressElement;
|
|
@@ -1,5 +1,108 @@
|
|
|
1
1
|
import {StripeError} from '../stripe';
|
|
2
2
|
import {StripeElementBase} from './base';
|
|
3
|
+
import {StripeExpressCheckoutElementConfirmEvent} from './express-checkout';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Address type used in PaymentFormElement change events.
|
|
7
|
+
*/
|
|
8
|
+
export type PaymentFormAddress = {
|
|
9
|
+
line1?: string | null;
|
|
10
|
+
line2?: string | null;
|
|
11
|
+
city?: string | null;
|
|
12
|
+
state?: string | null;
|
|
13
|
+
postal_code?: string | null;
|
|
14
|
+
country?: string | null;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The change event payload for the PaymentFormElement.
|
|
19
|
+
*/
|
|
20
|
+
export interface StripePaymentFormElementChangeEvent {
|
|
21
|
+
/**
|
|
22
|
+
* The type of element that emitted this event.
|
|
23
|
+
*/
|
|
24
|
+
elementType: 'paymentForm';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Whether all required fields in the PaymentFormElement are complete.
|
|
28
|
+
*/
|
|
29
|
+
complete: boolean;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Whether the PaymentFormElement is currently empty.
|
|
33
|
+
*/
|
|
34
|
+
empty: boolean;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* An object containing the current form values.
|
|
38
|
+
*/
|
|
39
|
+
value: {
|
|
40
|
+
customerDetails: {
|
|
41
|
+
email: string;
|
|
42
|
+
};
|
|
43
|
+
shippingOption?: {
|
|
44
|
+
id: string;
|
|
45
|
+
displayName: string;
|
|
46
|
+
amount: string;
|
|
47
|
+
};
|
|
48
|
+
shippingAddress?: PaymentFormAddress;
|
|
49
|
+
billingAddress?: PaymentFormAddress;
|
|
50
|
+
tax?: {
|
|
51
|
+
businessName: string;
|
|
52
|
+
taxId: string;
|
|
53
|
+
taxIdType: string;
|
|
54
|
+
externalTaxIdType: string;
|
|
55
|
+
};
|
|
56
|
+
customFields?: Record<string, string | number>;
|
|
57
|
+
payment?: {
|
|
58
|
+
collapsed: boolean;
|
|
59
|
+
type: string;
|
|
60
|
+
country?: string | null;
|
|
61
|
+
billingDetails?: {
|
|
62
|
+
address?: {
|
|
63
|
+
country?: string;
|
|
64
|
+
postal_code?: string;
|
|
65
|
+
};
|
|
66
|
+
} | null;
|
|
67
|
+
payment_method?: {
|
|
68
|
+
id: string;
|
|
69
|
+
type: string;
|
|
70
|
+
billing_details: {
|
|
71
|
+
address: PaymentFormAddress;
|
|
72
|
+
name: string | null;
|
|
73
|
+
email: string | null;
|
|
74
|
+
phone: string | null;
|
|
75
|
+
};
|
|
76
|
+
} | null;
|
|
77
|
+
savePaymentMethod?: boolean;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Confirm event when user completes via Express Checkout (Apple Pay, Google Pay, etc.)
|
|
84
|
+
*/
|
|
85
|
+
interface StripePaymentFormExpressCheckoutConfirmEvent
|
|
86
|
+
extends StripeExpressCheckoutElementConfirmEvent {
|
|
87
|
+
source: 'payment-form-ece';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Confirm event when user clicks the Pay button.
|
|
92
|
+
* paymentMethodType is the selected payment method (e.g., 'card', 'sepa_debit')
|
|
93
|
+
* or null if payment collection is not needed.
|
|
94
|
+
*/
|
|
95
|
+
interface StripePaymentFormPayButtonConfirmEvent {
|
|
96
|
+
source: 'payment-form-pay-button';
|
|
97
|
+
paymentMethodType: string | null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The confirm event payload for the PaymentFormElement.
|
|
102
|
+
*/
|
|
103
|
+
export type StripePaymentFormElementConfirmEvent =
|
|
104
|
+
| StripePaymentFormExpressCheckoutConfirmEvent
|
|
105
|
+
| StripePaymentFormPayButtonConfirmEvent;
|
|
3
106
|
|
|
4
107
|
export type StripePaymentFormElement = StripeElementBase & {
|
|
5
108
|
/**
|
|
@@ -18,6 +121,54 @@ export type StripePaymentFormElement = StripeElementBase & {
|
|
|
18
121
|
handler?: (event: {elementType: 'paymentForm'}) => any
|
|
19
122
|
): StripePaymentFormElement;
|
|
20
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Triggered when the element gains focus.
|
|
126
|
+
*/
|
|
127
|
+
on(
|
|
128
|
+
eventType: 'focus',
|
|
129
|
+
handler: (event: {elementType: 'paymentForm'}) => any
|
|
130
|
+
): StripePaymentFormElement;
|
|
131
|
+
once(
|
|
132
|
+
eventType: 'focus',
|
|
133
|
+
handler: (event: {elementType: 'paymentForm'}) => any
|
|
134
|
+
): StripePaymentFormElement;
|
|
135
|
+
off(
|
|
136
|
+
eventType: 'focus',
|
|
137
|
+
handler?: (event: {elementType: 'paymentForm'}) => any
|
|
138
|
+
): StripePaymentFormElement;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Triggered when the element loses focus.
|
|
142
|
+
*/
|
|
143
|
+
on(
|
|
144
|
+
eventType: 'blur',
|
|
145
|
+
handler: (event: {elementType: 'paymentForm'}) => any
|
|
146
|
+
): StripePaymentFormElement;
|
|
147
|
+
once(
|
|
148
|
+
eventType: 'blur',
|
|
149
|
+
handler: (event: {elementType: 'paymentForm'}) => any
|
|
150
|
+
): StripePaymentFormElement;
|
|
151
|
+
off(
|
|
152
|
+
eventType: 'blur',
|
|
153
|
+
handler?: (event: {elementType: 'paymentForm'}) => any
|
|
154
|
+
): StripePaymentFormElement;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Triggered when the escape key is pressed within the element.
|
|
158
|
+
*/
|
|
159
|
+
on(
|
|
160
|
+
eventType: 'escape',
|
|
161
|
+
handler: (event: {elementType: 'paymentForm'}) => any
|
|
162
|
+
): StripePaymentFormElement;
|
|
163
|
+
once(
|
|
164
|
+
eventType: 'escape',
|
|
165
|
+
handler: (event: {elementType: 'paymentForm'}) => any
|
|
166
|
+
): StripePaymentFormElement;
|
|
167
|
+
off(
|
|
168
|
+
eventType: 'escape',
|
|
169
|
+
handler?: (event: {elementType: 'paymentForm'}) => any
|
|
170
|
+
): StripePaymentFormElement;
|
|
171
|
+
|
|
21
172
|
/**
|
|
22
173
|
* Triggered when the element fails to load.
|
|
23
174
|
*/
|
|
@@ -33,4 +184,57 @@ export type StripePaymentFormElement = StripeElementBase & {
|
|
|
33
184
|
eventType: 'loaderror',
|
|
34
185
|
handler?: (event: {elementType: 'paymentForm'; error: StripeError}) => any
|
|
35
186
|
): StripePaymentFormElement;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Triggered when the element's value changes.
|
|
190
|
+
*/
|
|
191
|
+
on(
|
|
192
|
+
eventType: 'change',
|
|
193
|
+
handler: (event: StripePaymentFormElementChangeEvent) => any
|
|
194
|
+
): StripePaymentFormElement;
|
|
195
|
+
once(
|
|
196
|
+
eventType: 'change',
|
|
197
|
+
handler: (event: StripePaymentFormElementChangeEvent) => any
|
|
198
|
+
): StripePaymentFormElement;
|
|
199
|
+
off(
|
|
200
|
+
eventType: 'change',
|
|
201
|
+
handler?: (event: StripePaymentFormElementChangeEvent) => any
|
|
202
|
+
): StripePaymentFormElement;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Triggered when a buyer authorizes a payment within a supported payment method.
|
|
206
|
+
*/
|
|
207
|
+
on(
|
|
208
|
+
eventType: 'confirm',
|
|
209
|
+
handler: (event: StripePaymentFormElementConfirmEvent) => any
|
|
210
|
+
): StripePaymentFormElement;
|
|
211
|
+
once(
|
|
212
|
+
eventType: 'confirm',
|
|
213
|
+
handler: (event: StripePaymentFormElementConfirmEvent) => any
|
|
214
|
+
): StripePaymentFormElement;
|
|
215
|
+
off(
|
|
216
|
+
eventType: 'confirm',
|
|
217
|
+
handler?: (event: StripePaymentFormElementConfirmEvent) => any
|
|
218
|
+
): StripePaymentFormElement;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Triggered when the payment interface is dismissed (e.g., a buyer closes the payment interface).
|
|
222
|
+
*/
|
|
223
|
+
on(
|
|
224
|
+
eventType: 'cancel',
|
|
225
|
+
handler: (event: {elementType: 'paymentForm'}) => any
|
|
226
|
+
): StripePaymentFormElement;
|
|
227
|
+
once(
|
|
228
|
+
eventType: 'cancel',
|
|
229
|
+
handler: (event: {elementType: 'paymentForm'}) => any
|
|
230
|
+
): StripePaymentFormElement;
|
|
231
|
+
off(
|
|
232
|
+
eventType: 'cancel',
|
|
233
|
+
handler?: (event: {elementType: 'paymentForm'}) => any
|
|
234
|
+
): StripePaymentFormElement;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Retrieves the current form values from the PaymentFormElement.
|
|
238
|
+
*/
|
|
239
|
+
getValue(): Promise<StripePaymentFormElementChangeEvent>;
|
|
36
240
|
};
|
|
@@ -1,5 +1,108 @@
|
|
|
1
1
|
import {StripeError} from '../stripe';
|
|
2
2
|
import {StripeElementBase} from './base';
|
|
3
|
+
import {StripeExpressCheckoutElementConfirmEvent} from './express-checkout';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Address type used in PaymentFormElement change events.
|
|
7
|
+
*/
|
|
8
|
+
export type PaymentFormAddress = {
|
|
9
|
+
line1?: string | null;
|
|
10
|
+
line2?: string | null;
|
|
11
|
+
city?: string | null;
|
|
12
|
+
state?: string | null;
|
|
13
|
+
postal_code?: string | null;
|
|
14
|
+
country?: string | null;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The change event payload for the PaymentFormElement.
|
|
19
|
+
*/
|
|
20
|
+
export interface StripePaymentFormElementChangeEvent {
|
|
21
|
+
/**
|
|
22
|
+
* The type of element that emitted this event.
|
|
23
|
+
*/
|
|
24
|
+
elementType: 'paymentForm';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Whether all required fields in the PaymentFormElement are complete.
|
|
28
|
+
*/
|
|
29
|
+
complete: boolean;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Whether the PaymentFormElement is currently empty.
|
|
33
|
+
*/
|
|
34
|
+
empty: boolean;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* An object containing the current form values.
|
|
38
|
+
*/
|
|
39
|
+
value: {
|
|
40
|
+
customerDetails: {
|
|
41
|
+
email: string;
|
|
42
|
+
};
|
|
43
|
+
shippingOption?: {
|
|
44
|
+
id: string;
|
|
45
|
+
displayName: string;
|
|
46
|
+
amount: string;
|
|
47
|
+
};
|
|
48
|
+
shippingAddress?: PaymentFormAddress;
|
|
49
|
+
billingAddress?: PaymentFormAddress;
|
|
50
|
+
tax?: {
|
|
51
|
+
businessName: string;
|
|
52
|
+
taxId: string;
|
|
53
|
+
taxIdType: string;
|
|
54
|
+
externalTaxIdType: string;
|
|
55
|
+
};
|
|
56
|
+
customFields?: Record<string, string | number>;
|
|
57
|
+
payment?: {
|
|
58
|
+
collapsed: boolean;
|
|
59
|
+
type: string;
|
|
60
|
+
country?: string | null;
|
|
61
|
+
billingDetails?: {
|
|
62
|
+
address?: {
|
|
63
|
+
country?: string;
|
|
64
|
+
postal_code?: string;
|
|
65
|
+
};
|
|
66
|
+
} | null;
|
|
67
|
+
payment_method?: {
|
|
68
|
+
id: string;
|
|
69
|
+
type: string;
|
|
70
|
+
billing_details: {
|
|
71
|
+
address: PaymentFormAddress;
|
|
72
|
+
name: string | null;
|
|
73
|
+
email: string | null;
|
|
74
|
+
phone: string | null;
|
|
75
|
+
};
|
|
76
|
+
} | null;
|
|
77
|
+
savePaymentMethod?: boolean;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Confirm event when user completes via Express Checkout (Apple Pay, Google Pay, etc.)
|
|
84
|
+
*/
|
|
85
|
+
interface StripePaymentFormExpressCheckoutConfirmEvent
|
|
86
|
+
extends StripeExpressCheckoutElementConfirmEvent {
|
|
87
|
+
source: 'payment-form-ece';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Confirm event when user clicks the Pay button.
|
|
92
|
+
* paymentMethodType is the selected payment method (e.g., 'card', 'sepa_debit')
|
|
93
|
+
* or null if payment collection is not needed.
|
|
94
|
+
*/
|
|
95
|
+
interface StripePaymentFormPayButtonConfirmEvent {
|
|
96
|
+
source: 'payment-form-pay-button';
|
|
97
|
+
paymentMethodType: string | null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The confirm event payload for the PaymentFormElement.
|
|
102
|
+
*/
|
|
103
|
+
export type StripePaymentFormElementConfirmEvent =
|
|
104
|
+
| StripePaymentFormExpressCheckoutConfirmEvent
|
|
105
|
+
| StripePaymentFormPayButtonConfirmEvent;
|
|
3
106
|
|
|
4
107
|
export type StripePaymentFormElement = StripeElementBase & {
|
|
5
108
|
/**
|
|
@@ -18,6 +121,54 @@ export type StripePaymentFormElement = StripeElementBase & {
|
|
|
18
121
|
handler?: (event: {elementType: 'paymentForm'}) => any
|
|
19
122
|
): StripePaymentFormElement;
|
|
20
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Triggered when the element gains focus.
|
|
126
|
+
*/
|
|
127
|
+
on(
|
|
128
|
+
eventType: 'focus',
|
|
129
|
+
handler: (event: {elementType: 'paymentForm'}) => any
|
|
130
|
+
): StripePaymentFormElement;
|
|
131
|
+
once(
|
|
132
|
+
eventType: 'focus',
|
|
133
|
+
handler: (event: {elementType: 'paymentForm'}) => any
|
|
134
|
+
): StripePaymentFormElement;
|
|
135
|
+
off(
|
|
136
|
+
eventType: 'focus',
|
|
137
|
+
handler?: (event: {elementType: 'paymentForm'}) => any
|
|
138
|
+
): StripePaymentFormElement;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Triggered when the element loses focus.
|
|
142
|
+
*/
|
|
143
|
+
on(
|
|
144
|
+
eventType: 'blur',
|
|
145
|
+
handler: (event: {elementType: 'paymentForm'}) => any
|
|
146
|
+
): StripePaymentFormElement;
|
|
147
|
+
once(
|
|
148
|
+
eventType: 'blur',
|
|
149
|
+
handler: (event: {elementType: 'paymentForm'}) => any
|
|
150
|
+
): StripePaymentFormElement;
|
|
151
|
+
off(
|
|
152
|
+
eventType: 'blur',
|
|
153
|
+
handler?: (event: {elementType: 'paymentForm'}) => any
|
|
154
|
+
): StripePaymentFormElement;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Triggered when the escape key is pressed within the element.
|
|
158
|
+
*/
|
|
159
|
+
on(
|
|
160
|
+
eventType: 'escape',
|
|
161
|
+
handler: (event: {elementType: 'paymentForm'}) => any
|
|
162
|
+
): StripePaymentFormElement;
|
|
163
|
+
once(
|
|
164
|
+
eventType: 'escape',
|
|
165
|
+
handler: (event: {elementType: 'paymentForm'}) => any
|
|
166
|
+
): StripePaymentFormElement;
|
|
167
|
+
off(
|
|
168
|
+
eventType: 'escape',
|
|
169
|
+
handler?: (event: {elementType: 'paymentForm'}) => any
|
|
170
|
+
): StripePaymentFormElement;
|
|
171
|
+
|
|
21
172
|
/**
|
|
22
173
|
* Triggered when the element fails to load.
|
|
23
174
|
*/
|
|
@@ -33,4 +184,57 @@ export type StripePaymentFormElement = StripeElementBase & {
|
|
|
33
184
|
eventType: 'loaderror',
|
|
34
185
|
handler?: (event: {elementType: 'paymentForm'; error: StripeError}) => any
|
|
35
186
|
): StripePaymentFormElement;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Triggered when the element's value changes.
|
|
190
|
+
*/
|
|
191
|
+
on(
|
|
192
|
+
eventType: 'change',
|
|
193
|
+
handler: (event: StripePaymentFormElementChangeEvent) => any
|
|
194
|
+
): StripePaymentFormElement;
|
|
195
|
+
once(
|
|
196
|
+
eventType: 'change',
|
|
197
|
+
handler: (event: StripePaymentFormElementChangeEvent) => any
|
|
198
|
+
): StripePaymentFormElement;
|
|
199
|
+
off(
|
|
200
|
+
eventType: 'change',
|
|
201
|
+
handler?: (event: StripePaymentFormElementChangeEvent) => any
|
|
202
|
+
): StripePaymentFormElement;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Triggered when a buyer authorizes a payment within a supported payment method.
|
|
206
|
+
*/
|
|
207
|
+
on(
|
|
208
|
+
eventType: 'confirm',
|
|
209
|
+
handler: (event: StripePaymentFormElementConfirmEvent) => any
|
|
210
|
+
): StripePaymentFormElement;
|
|
211
|
+
once(
|
|
212
|
+
eventType: 'confirm',
|
|
213
|
+
handler: (event: StripePaymentFormElementConfirmEvent) => any
|
|
214
|
+
): StripePaymentFormElement;
|
|
215
|
+
off(
|
|
216
|
+
eventType: 'confirm',
|
|
217
|
+
handler?: (event: StripePaymentFormElementConfirmEvent) => any
|
|
218
|
+
): StripePaymentFormElement;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Triggered when the payment interface is dismissed (e.g., a buyer closes the payment interface).
|
|
222
|
+
*/
|
|
223
|
+
on(
|
|
224
|
+
eventType: 'cancel',
|
|
225
|
+
handler: (event: {elementType: 'paymentForm'}) => any
|
|
226
|
+
): StripePaymentFormElement;
|
|
227
|
+
once(
|
|
228
|
+
eventType: 'cancel',
|
|
229
|
+
handler: (event: {elementType: 'paymentForm'}) => any
|
|
230
|
+
): StripePaymentFormElement;
|
|
231
|
+
off(
|
|
232
|
+
eventType: 'cancel',
|
|
233
|
+
handler?: (event: {elementType: 'paymentForm'}) => any
|
|
234
|
+
): StripePaymentFormElement;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Retrieves the current form values from the PaymentFormElement.
|
|
238
|
+
*/
|
|
239
|
+
getValue(): Promise<StripePaymentFormElementChangeEvent>;
|
|
36
240
|
};
|