@stripe/stripe-js 2.1.0 → 2.1.1
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/stripe-js/custom-checkout.d.ts +216 -0
- package/types/stripe-js/elements-group.d.ts +1 -7
- package/types/stripe-js/index.d.ts +1 -0
- package/types/stripe-js/stripe.d.ts +12 -0
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
|
@@ -0,0 +1,216 @@
|
|
|
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
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Requires beta access:
|
|
16
|
+
* Contact [Stripe support](https://support.stripe.com/) for more information.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* StripeCustomCheckoutInitOptions
|
|
21
|
+
*/
|
|
22
|
+
export interface StripeCustomCheckoutElementsOptions {
|
|
23
|
+
appearance?: Appearance;
|
|
24
|
+
loader?: 'auto' | 'always' | 'never';
|
|
25
|
+
fonts?: Array<CssFontSource | CustomFontSource>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface StripeCustomCheckoutOptions {
|
|
29
|
+
clientSecret: string;
|
|
30
|
+
elementsOptions?: StripeCustomCheckoutElementsOptions;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* StripeCustomCheckoutActions
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
export type StripeCustomCheckoutAddress = {
|
|
38
|
+
country: string | null;
|
|
39
|
+
line1: string | null;
|
|
40
|
+
line2?: string | null;
|
|
41
|
+
city: string | null;
|
|
42
|
+
postal_code: string | null;
|
|
43
|
+
state: string | null;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type StripeCustomCheckoutShippingAddress = {
|
|
47
|
+
name?: string | null;
|
|
48
|
+
address: StripeCustomCheckoutAddress;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type StripeCustomCheckoutBillingAddress = StripeCustomCheckoutShippingAddress;
|
|
52
|
+
|
|
53
|
+
export interface StripeCustomCheckoutActions {
|
|
54
|
+
applyPromotionCode: (promotionCode: string) => Promise<void>;
|
|
55
|
+
removePromotionCode: () => Promise<void>;
|
|
56
|
+
updateShippingAddress: (
|
|
57
|
+
shippingAddress: StripeCustomCheckoutShippingAddress
|
|
58
|
+
) => Promise<void>;
|
|
59
|
+
updateBillingAddress: (
|
|
60
|
+
billingAddress: StripeCustomCheckoutBillingAddress
|
|
61
|
+
) => Promise<void>;
|
|
62
|
+
updatePhoneNumber: (phoneNumber: string) => void;
|
|
63
|
+
updateEmail: (email: string) => void;
|
|
64
|
+
updateLineItemQuantity: (args: {
|
|
65
|
+
lineItem: string;
|
|
66
|
+
quantity: number;
|
|
67
|
+
}) => Promise<void>;
|
|
68
|
+
updateShippingOption: (shippingOption: string) => Promise<void>;
|
|
69
|
+
confirm: (args?: {return_url?: string}) => Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* StripeCustomCheckoutSession
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
export type StripeCustomCheckoutTaxAmount = {
|
|
77
|
+
amount: number;
|
|
78
|
+
inclusive: boolean;
|
|
79
|
+
displayName: string;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export type StripeCustomCheckoutDiscountAmount = {
|
|
83
|
+
amount: number;
|
|
84
|
+
displayName: string;
|
|
85
|
+
promotionCode?: string | null;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export type StripeCustomCheckoutShipping = {
|
|
89
|
+
shippingOption: StripeCustomCheckoutShippingOption;
|
|
90
|
+
taxAmounts?: Array<StripeCustomCheckoutTaxAmount> | null;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export type StripeCustomCheckoutShippingOption = {
|
|
94
|
+
id: string;
|
|
95
|
+
amount: number;
|
|
96
|
+
currency: string;
|
|
97
|
+
displayName?: string | null;
|
|
98
|
+
deliveryEstimate?: StripeCustomCheckoutDeliveryEstimate | null;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export type StripeCustomCheckoutDeliveryEstimate = {
|
|
102
|
+
maximum?: StripeCustomCheckoutEstimate | null;
|
|
103
|
+
minimum?: StripeCustomCheckoutEstimate | null;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export type StripeCustomCheckoutEstimate = {
|
|
107
|
+
unit: 'business_day' | 'day' | 'hour' | 'week' | 'month';
|
|
108
|
+
value: number;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export type StripeCustomCheckoutLineItemDiscountAmount = {
|
|
112
|
+
amount: number;
|
|
113
|
+
promotionCode?: string | null;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export type StripeCustomCheckoutBillingInterval =
|
|
117
|
+
| 'day'
|
|
118
|
+
| 'month'
|
|
119
|
+
| 'week'
|
|
120
|
+
| 'year';
|
|
121
|
+
|
|
122
|
+
export type StripeCustomCheckoutLineItem = {
|
|
123
|
+
id: string;
|
|
124
|
+
name: string;
|
|
125
|
+
amount: number;
|
|
126
|
+
unitAmount: number;
|
|
127
|
+
description?: string | null;
|
|
128
|
+
quantity: number;
|
|
129
|
+
discountAmounts?: Array<StripeCustomCheckoutLineItemDiscountAmount> | null;
|
|
130
|
+
recurring?: {
|
|
131
|
+
interval: StripeCustomCheckoutBillingInterval;
|
|
132
|
+
interval_count: number;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export type StripeCustomCheckoutTotalSummary = {
|
|
137
|
+
subtotal: number;
|
|
138
|
+
taxExclusive: number;
|
|
139
|
+
taxInclusive: number;
|
|
140
|
+
shippingRate: number;
|
|
141
|
+
discount: number;
|
|
142
|
+
total: number;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export type StripeCustomCheckoutConfirmationRequirement =
|
|
146
|
+
| 'phoneNumber'
|
|
147
|
+
| 'shippingAddress'
|
|
148
|
+
| 'billingAddress'
|
|
149
|
+
| 'paymentDetails'
|
|
150
|
+
| 'email';
|
|
151
|
+
|
|
152
|
+
export interface StripeCustomCheckoutSession {
|
|
153
|
+
lineItems: Array<StripeCustomCheckoutLineItem>;
|
|
154
|
+
taxAmounts?: Array<StripeCustomCheckoutTaxAmount> | null;
|
|
155
|
+
discountAmounts?: Array<StripeCustomCheckoutDiscountAmount> | null;
|
|
156
|
+
currency: string;
|
|
157
|
+
shipping?: StripeCustomCheckoutShipping | null;
|
|
158
|
+
shippingOptions: Array<StripeCustomCheckoutShippingOption>;
|
|
159
|
+
shippingAddress?: StripeCustomCheckoutShippingAddress | null;
|
|
160
|
+
billingAddress?: StripeCustomCheckoutBillingAddress | null;
|
|
161
|
+
phoneNumber?: string | null;
|
|
162
|
+
email?: string | null;
|
|
163
|
+
total: StripeCustomCheckoutTotalSummary;
|
|
164
|
+
confirmationRequirements: StripeCustomCheckoutConfirmationRequirement[];
|
|
165
|
+
canConfirm: boolean;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* StripeCustomCheckoutElements
|
|
170
|
+
*/
|
|
171
|
+
export type StripeCustomCheckoutPaymentElementOptions = {
|
|
172
|
+
layout?: Layout | LayoutObject;
|
|
173
|
+
paymentMethodOrder?: Array<string>;
|
|
174
|
+
readonly?: boolean;
|
|
175
|
+
terms?: TermsOption;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export type StripeCustomCheckoutAddressElementOptions = {
|
|
179
|
+
mode: AddressMode;
|
|
180
|
+
contacts?: ContactOption[];
|
|
181
|
+
display?: {
|
|
182
|
+
name?: 'full' | 'split' | 'organization';
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export interface StripeCustomCheckoutElementsActions {
|
|
187
|
+
changeAppearance: (appearance: Appearance) => void;
|
|
188
|
+
getElement(elementType: 'payment'): StripePaymentElement | null;
|
|
189
|
+
getElement(
|
|
190
|
+
elementType: 'address',
|
|
191
|
+
mode: AddressMode
|
|
192
|
+
): StripeAddressElement | null;
|
|
193
|
+
createElement(
|
|
194
|
+
elementType: 'payment',
|
|
195
|
+
options?: StripeCustomCheckoutPaymentElementOptions
|
|
196
|
+
): StripePaymentElement;
|
|
197
|
+
createElement(
|
|
198
|
+
elementType: 'address',
|
|
199
|
+
options: StripeCustomCheckoutAddressElementOptions
|
|
200
|
+
): StripeAddressElement;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* StripeCustomCheckout
|
|
205
|
+
*/
|
|
206
|
+
export type StripeCustomCheckoutUpdateHandler = (
|
|
207
|
+
session: StripeCustomCheckoutSession
|
|
208
|
+
) => void;
|
|
209
|
+
|
|
210
|
+
export interface StripeCustomCheckout
|
|
211
|
+
extends StripeCustomCheckoutActions,
|
|
212
|
+
StripeCustomCheckoutSession,
|
|
213
|
+
StripeCustomCheckoutElementsActions {
|
|
214
|
+
session: () => StripeCustomCheckoutSession;
|
|
215
|
+
on: (event: 'change', handler: StripeCustomCheckoutUpdateHandler) => void;
|
|
216
|
+
}
|
|
@@ -378,10 +378,7 @@ export interface StripeElements {
|
|
|
378
378
|
/////////////////////////////
|
|
379
379
|
|
|
380
380
|
/**
|
|
381
|
-
*
|
|
382
|
-
* Contact [Stripe support](https://support.stripe.com/) for more information.
|
|
383
|
-
*
|
|
384
|
-
* Creates a `ExpressCheckoutElement`.
|
|
381
|
+
* Creates an `ExpressCheckoutElement`.
|
|
385
382
|
*/
|
|
386
383
|
create(
|
|
387
384
|
elementType: 'expressCheckout',
|
|
@@ -389,9 +386,6 @@ export interface StripeElements {
|
|
|
389
386
|
): StripeExpressCheckoutElement;
|
|
390
387
|
|
|
391
388
|
/**
|
|
392
|
-
* Requires beta access:
|
|
393
|
-
* Contact [Stripe support](https://support.stripe.com/) for more information.
|
|
394
|
-
*
|
|
395
389
|
* Looks up a previously created `Element` by its type.
|
|
396
390
|
*/
|
|
397
391
|
getElement(
|
|
@@ -15,6 +15,10 @@ import {
|
|
|
15
15
|
import {CheckoutLocale, RedirectToCheckoutOptions} from './checkout';
|
|
16
16
|
import {PaymentRequestOptions, PaymentRequest} from './payment-request';
|
|
17
17
|
import {StripeElement, StripeElementLocale} from './elements-group';
|
|
18
|
+
import {
|
|
19
|
+
StripeCustomCheckoutOptions,
|
|
20
|
+
StripeCustomCheckout,
|
|
21
|
+
} from './custom-checkout';
|
|
18
22
|
|
|
19
23
|
export interface Stripe {
|
|
20
24
|
/////////////////////////////
|
|
@@ -1193,6 +1197,14 @@ export interface Stripe {
|
|
|
1193
1197
|
createEphemeralKeyNonce(
|
|
1194
1198
|
options: ephemeralKeys.EphemeralKeyNonceOptions
|
|
1195
1199
|
): Promise<EphemeralKeyNonceResult>;
|
|
1200
|
+
|
|
1201
|
+
/**
|
|
1202
|
+
* Requires beta access:
|
|
1203
|
+
* Contact [Stripe support](https://support.stripe.com/) for more information.
|
|
1204
|
+
*/
|
|
1205
|
+
initCustomCheckout(
|
|
1206
|
+
options: StripeCustomCheckoutOptions
|
|
1207
|
+
): Promise<StripeCustomCheckout>;
|
|
1196
1208
|
}
|
|
1197
1209
|
|
|
1198
1210
|
export type PaymentIntentResult =
|