@@ -4,11 +4,7 @@ import {
4
4
TermsOption ,
5
5
StripePaymentElement ,
6
6
} from './elements/payment' ;
7
- import {
8
- AddressMode ,
9
- ContactOption ,
10
- StripeAddressElement ,
11
- } from './elements/address' ;
7
+ import { ContactOption , StripeAddressElement } from './elements/address' ;
12
8
import { Appearance , CssFontSource , CustomFontSource } from './elements-group' ;
13
9
import { StripeError } from './stripe' ;
14
10
import {
@@ -33,7 +29,7 @@ export interface StripeCheckoutElementsOptions {
33
29
}
34
30
35
31
export interface StripeCheckoutOptions {
36
- clientSecret : string ;
32
+ fetchClientSecret : ( ) => Promise < string > ;
37
33
elementsOptions ?: StripeCheckoutElementsOptions ;
38
34
}
39
35
@@ -54,13 +50,6 @@ export type StripeCheckoutAdjustableQuantity = {
54
50
55
51
export type StripeCheckoutBillingInterval = 'day' | 'month' | 'week' | 'year' ;
56
52
57
- export type StripeCheckoutConfirmationRequirement =
58
- | 'phoneNumber'
59
- | 'shippingAddress'
60
- | 'billingAddress'
61
- | 'paymentDetails'
62
- | 'email' ;
63
-
64
53
export type StripeCheckoutContact = {
65
54
name ?: string | null ;
66
55
address : StripeCheckoutAddress ;
@@ -71,8 +60,9 @@ export type StripeCheckoutDeliveryEstimate = {
71
60
minimum : StripeCheckoutEstimate | null ;
72
61
} ;
73
62
74
- export type StripeCheckoutDiscountAmount = {
75
- amount : number ;
63
+ export type StripeCheckoutAmount = { minorUnitsAmount : number ; amount : string } ;
64
+
65
+ export type StripeCheckoutDiscountAmount = StripeCheckoutAmount & {
76
66
displayName : string ;
77
67
promotionCode : string | null ;
78
68
recurring :
@@ -82,10 +72,10 @@ export type StripeCheckoutDiscountAmount = {
82
72
} ;
83
73
84
74
export type StripeCheckoutDueNext = {
85
- amountSubtotal : number ;
86
- amountDiscount : number ;
87
- amountTaxInclusive : number ;
88
- amountTaxExclusive : number ;
75
+ subtotal : StripeCheckoutAmount ;
76
+ discount : StripeCheckoutAmount ;
77
+ taxInclusive : StripeCheckoutAmount ;
78
+ taxExclusive : StripeCheckoutAmount ;
89
79
billingCycleAnchor : number | null ;
90
80
} ;
91
81
@@ -124,20 +114,20 @@ export type StripeCheckoutSavedPaymentMethod = {
124
114
} ;
125
115
} ;
126
116
127
- export type StripeCheckoutTaxAmount = {
128
- amount : number ;
117
+ export type StripeCheckoutTaxAmount = StripeCheckoutAmount & {
129
118
inclusive : boolean ;
130
119
displayName : string ;
131
120
} ;
132
121
133
122
export type StripeCheckoutLineItem = {
134
123
id : string ;
135
124
name : string ;
136
- amountDiscount : number ;
137
- amountSubtotal : number ;
138
- amountTaxExclusive : number ;
139
- amountTaxInclusive : number ;
140
- unitAmount : number ;
125
+ discount : StripeCheckoutAmount ;
126
+ subtotal : StripeCheckoutAmount ;
127
+ total : StripeCheckoutAmount ;
128
+ taxExclusive : StripeCheckoutAmount ;
129
+ taxInclusive : StripeCheckoutAmount ;
130
+ unitAmount : StripeCheckoutAmount ;
141
131
description : string | null ;
142
132
quantity : number ;
143
133
discountAmounts : Array < StripeCheckoutDiscountAmount > | null ;
@@ -164,9 +154,8 @@ export type StripeCheckoutShipping = {
164
154
taxAmounts : Array < StripeCheckoutTaxAmount > | null ;
165
155
} ;
166
156
167
- export type StripeCheckoutShippingOption = {
157
+ export type StripeCheckoutShippingOption = StripeCheckoutAmount & {
168
158
id : string ;
169
- amount : number ;
170
159
currency : string ;
171
160
displayName : string | null ;
172
161
deliveryEstimate : StripeCheckoutDeliveryEstimate | null ;
@@ -186,23 +175,22 @@ export type StripeCheckoutTaxStatus =
186
175
| { status : 'requires_billing_address' } ;
187
176
188
177
export type StripeCheckoutTotalSummary = {
189
- appliedBalance : number ;
178
+ appliedBalance : StripeCheckoutAmount ;
190
179
balanceAppliedToNextInvoice : boolean ;
191
- discount : number ;
192
- shippingRate : number ;
193
- subtotal : number ;
194
- taxExclusive : number ;
195
- taxInclusive : number ;
196
- total : number ;
180
+ discount : StripeCheckoutAmount ;
181
+ shippingRate : StripeCheckoutAmount ;
182
+ subtotal : StripeCheckoutAmount ;
183
+ taxExclusive : StripeCheckoutAmount ;
184
+ taxInclusive : StripeCheckoutAmount ;
185
+ total : StripeCheckoutAmount ;
197
186
} ;
198
187
199
188
export type StripeCheckoutTrial = {
200
189
trialEnd : number ;
201
190
trialPeriodDays : number ;
202
191
} ;
203
192
204
- export type StripeCheckoutCurrencyOption = {
205
- amount : number ;
193
+ export type StripeCheckoutCurrencyOption = StripeCheckoutAmount & {
206
194
currency : string ;
207
195
currencyConversion ?: { fxRate : number ; sourceCurrency : string } ;
208
196
} ;
@@ -324,7 +312,6 @@ export interface StripeCheckoutSession {
324
312
billingAddress : StripeCheckoutContact | null ;
325
313
businessName : string | null ;
326
314
canConfirm : boolean ;
327
- confirmationRequirements : StripeCheckoutConfirmationRequirement [ ] ;
328
315
currency : string ;
329
316
currencyOptions : Array < StripeCheckoutCurrencyOption > | null ;
330
317
discountAmounts : Array < StripeCheckoutDiscountAmount > | null ;
@@ -333,6 +320,7 @@ export interface StripeCheckoutSession {
333
320
lastPaymentError : StripeCheckoutLastPaymentError | null ;
334
321
lineItems : Array < StripeCheckoutLineItem > ;
335
322
livemode : boolean ;
323
+ minorUnitsAmountDivisor : number ;
336
324
phoneNumber : string | null ;
337
325
recurring : StripeCheckoutRecurring | null ;
338
326
savedPaymentMethods : Array < StripeCheckoutSavedPaymentMethod > | null ;
@@ -355,7 +343,6 @@ export type StripeCheckoutPaymentElementOptions = {
355
343
} ;
356
344
357
345
export type StripeCheckoutAddressElementOptions = {
358
- mode : AddressMode ;
359
346
contacts ?: ContactOption [ ] ;
360
347
display ?: {
361
348
name ?: 'full' | 'split' | 'organization' ;
@@ -593,30 +580,24 @@ export interface StripeCheckout {
593
580
594
581
/* Elements methods */
595
582
changeAppearance : ( appearance : Appearance ) => void ;
596
- getElement ( elementType : 'payment' ) : StripePaymentElement | null ;
597
- getElement (
598
- elementType : 'address' ,
599
- mode : AddressMode
600
- ) : StripeAddressElement | null ;
601
- getElement (
602
- elementType : 'expressCheckout'
603
- ) : StripeCheckoutExpressCheckoutElement | null ;
583
+ getPaymentElement ( ) : StripePaymentElement | null ;
584
+ getBillingAddressElement ( ) : StripeAddressElement | null ;
585
+ getShippingAddressElement ( ) : StripeAddressElement | null ;
586
+ getExpressCheckoutElement ( ) : StripeCheckoutExpressCheckoutElement | null ;
604
587
/* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */
605
- getElement (
606
- elementType : 'currencySelector'
607
- ) : StripeCurrencySelectorElement | null ;
608
- createElement (
609
- elementType : 'payment' ,
588
+ getCurrencySelectorElement ( ) : StripeCurrencySelectorElement | null ;
589
+ createPaymentElement (
610
590
options ?: StripeCheckoutPaymentElementOptions
611
591
) : StripePaymentElement ;
612
- createElement (
613
- elementType : 'address' ,
614
- options : StripeCheckoutAddressElementOptions
592
+ createBillingAddressElement (
593
+ options ?: StripeCheckoutAddressElementOptions
594
+ ) : StripeAddressElement ;
595
+ createShippingAddressElement (
596
+ options ?: StripeCheckoutAddressElementOptions
615
597
) : StripeAddressElement ;
616
- createElement (
617
- elementType : 'expressCheckout' ,
618
- options : StripeCheckoutExpressCheckoutElementOptions
598
+ createExpressCheckoutElement (
599
+ options ?: StripeCheckoutExpressCheckoutElementOptions
619
600
) : StripeCheckoutExpressCheckoutElement ;
620
601
/* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */
621
- createElement ( elementType : 'currencySelector' ) : StripeCurrencySelectorElement ;
602
+ createCurrencySelectorElement ( ) : StripeCurrencySelectorElement ;
622
603
}
0 commit comments