@stripe/stripe-js 2.0.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 CHANGED
@@ -54,7 +54,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
54
54
 
55
55
  stripe._registerWrapper({
56
56
  name: 'stripe-js',
57
- version: "2.0.0",
57
+ version: "2.1.1",
58
58
  startTime: startTime
59
59
  });
60
60
  };
package/dist/pure.js CHANGED
@@ -58,7 +58,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
58
58
 
59
59
  stripe._registerWrapper({
60
60
  name: 'stripe-js',
61
- version: "2.0.0",
61
+ version: "2.1.1",
62
62
  startTime: startTime
63
63
  });
64
64
  };
@@ -38,7 +38,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
38
38
 
39
39
  stripe._registerWrapper({
40
40
  name: 'stripe-js',
41
- version: "2.0.0",
41
+ version: "2.1.1",
42
42
  startTime: startTime
43
43
  });
44
44
  };
package/dist/stripe.js CHANGED
@@ -42,7 +42,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
42
42
 
43
43
  stripe._registerWrapper({
44
44
  name: 'stripe-js',
45
- version: "2.0.0",
45
+ version: "2.1.1",
46
46
  startTime: startTime
47
47
  });
48
48
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/stripe-js",
3
- "version": "2.0.0",
3
+ "version": "2.1.1",
4
4
  "description": "Stripe.js loading utility",
5
5
  "main": "dist/stripe.js",
6
6
  "module": "dist/stripe.esm.js",
@@ -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
- * Requires beta access:
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(
@@ -723,6 +717,20 @@ export interface StripeElementsOptionsMode extends BaseStripeElementsOptions {
723
717
  */
724
718
  capture_method?: 'manual' | 'automatic';
725
719
 
720
+ /**
721
+ * The Stripe account ID which is the business of record.
722
+ *
723
+ * @docs https://stripe.com/docs/js/elements_object/create_without_intent#stripe_elements_no_intent-options-onBehalfOf
724
+ */
725
+ onBehalfOf?: string;
726
+
727
+ /**
728
+ * The Stripe account ID which is the business of record.
729
+ *
730
+ * @docs https://stripe.com/docs/js/elements_object/create_without_intent#stripe_elements_no_intent-options-onBehalfOf
731
+ */
732
+ on_behalf_of?: string;
733
+
726
734
  /**
727
735
  * Instead of using automatic payment methods, declare specific payment methods to enable.
728
736
  *
@@ -1,4 +1,5 @@
1
1
  export * from './checkout';
2
+ export * from './custom-checkout';
2
3
  export * from './elements';
3
4
  export * from './elements-group';
4
5
  export * from './ephemeral-keys';
@@ -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 =