@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,153 @@
|
|
|
1
|
+
export interface RedirectToCheckoutServerOptions {
|
|
2
|
+
/**
|
|
3
|
+
* The ID of the [Checkout Session](https://stripe.com/docs/api/checkout/sessions) that is used in [Checkout's server integration](https://stripe.com/docs/payments/checkout/one-time).
|
|
4
|
+
*/
|
|
5
|
+
sessionId: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface RedirectToCheckoutClientOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The URL to which Stripe should send customers when payment is complete.
|
|
11
|
+
* If you’d like access to the Checkout Session for the successful payment, read more about it in our guide on [fulfilling your payments with webhooks](https://stripe.com/docs/payments/checkout/fulfillment#webhooks).
|
|
12
|
+
*/
|
|
13
|
+
successUrl: string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The URL to which Stripe should send customers when payment is canceled.
|
|
17
|
+
*/
|
|
18
|
+
cancelUrl: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* An array of objects representing the items that your customer would like to purchase.
|
|
22
|
+
* These items are shown as line items in the Checkout interface and make up the total amount to be collected by Checkout.
|
|
23
|
+
*/
|
|
24
|
+
lineItems?: Array<{
|
|
25
|
+
/**
|
|
26
|
+
* The ID of the price that the customer would like to purchase. SKU or plan IDs may also be used.
|
|
27
|
+
*/
|
|
28
|
+
price?: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The quantity of units for the item.
|
|
32
|
+
*/
|
|
33
|
+
quantity?: number;
|
|
34
|
+
}>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* An array of objects representing the items that your customer would like to purchase.
|
|
38
|
+
* These items are shown as line items in the Checkout interface and make up the total amount to be collected by Checkout.
|
|
39
|
+
*
|
|
40
|
+
* @deprecated
|
|
41
|
+
*/
|
|
42
|
+
items?: Array<{
|
|
43
|
+
/**
|
|
44
|
+
* The ID of the SKU that the customer would like to purchase
|
|
45
|
+
*/
|
|
46
|
+
sku?: string;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The ID of the plan that the customer would like to subscribe to.
|
|
50
|
+
*/
|
|
51
|
+
plan?: string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The quantity of units for the item.
|
|
55
|
+
*/
|
|
56
|
+
quantity?: number;
|
|
57
|
+
}>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The mode of the Checkout Session. Required if using lineItems.
|
|
61
|
+
*/
|
|
62
|
+
mode?: 'payment' | 'subscription';
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* A unique string to reference the Checkout session.
|
|
66
|
+
* This can be a customer ID, a cart ID, or similar.
|
|
67
|
+
* It is included in the `checkout.session.completed` webhook and can be used to fulfill the purchase.
|
|
68
|
+
*/
|
|
69
|
+
clientReferenceId?: string;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The email address used to create the customer object.
|
|
73
|
+
* If you already know your customer's email address, use this attribute to prefill it on Checkout.
|
|
74
|
+
*/
|
|
75
|
+
customerEmail?: string;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Specify whether Checkout should collect the customer’s billing address.
|
|
79
|
+
* If set to `required`, Checkout will attempt to collect the customer’s billing address.
|
|
80
|
+
* If not set or set to `auto` Checkout will only attempt to collect the billing address when necessary.
|
|
81
|
+
*/
|
|
82
|
+
billingAddressCollection?: 'auto' | 'required';
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Provides configuration for Checkout to collect a shipping address from a customer.
|
|
86
|
+
*/
|
|
87
|
+
shippingAddressCollection?: {
|
|
88
|
+
/**
|
|
89
|
+
* An array of two-letter ISO country codes representing which countries
|
|
90
|
+
* Checkout should provide as options for shipping locations. The codes are
|
|
91
|
+
* expected to be uppercase. Unsupported country codes: AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI.
|
|
92
|
+
*/
|
|
93
|
+
allowedCountries: string[];
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) of the locale to display Checkout in.
|
|
98
|
+
* Default is `auto` (Stripe detects the locale of the browser).
|
|
99
|
+
*/
|
|
100
|
+
locale?: CheckoutLocale;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the **Submit** button.
|
|
104
|
+
* `submitType` can only be specified when using using line items or SKUs, and not subscriptions.
|
|
105
|
+
* The default is `auto`.
|
|
106
|
+
*/
|
|
107
|
+
submitType?: 'auto' | 'book' | 'donate' | 'pay';
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export type RedirectToCheckoutOptions =
|
|
111
|
+
| RedirectToCheckoutServerOptions
|
|
112
|
+
| RedirectToCheckoutClientOptions;
|
|
113
|
+
|
|
114
|
+
export type CheckoutLocale =
|
|
115
|
+
| 'auto'
|
|
116
|
+
| 'bg'
|
|
117
|
+
| 'cs'
|
|
118
|
+
| 'da'
|
|
119
|
+
| 'de'
|
|
120
|
+
| 'el'
|
|
121
|
+
| 'en'
|
|
122
|
+
| 'en-GB'
|
|
123
|
+
| 'es'
|
|
124
|
+
| 'es-419'
|
|
125
|
+
| 'et'
|
|
126
|
+
| 'fi'
|
|
127
|
+
| 'fil'
|
|
128
|
+
| 'fr'
|
|
129
|
+
| 'fr-CA'
|
|
130
|
+
| 'hr'
|
|
131
|
+
| 'hu'
|
|
132
|
+
| 'id'
|
|
133
|
+
| 'it'
|
|
134
|
+
| 'ja'
|
|
135
|
+
| 'lt'
|
|
136
|
+
| 'lv'
|
|
137
|
+
| 'ms'
|
|
138
|
+
| 'mt'
|
|
139
|
+
| 'nb'
|
|
140
|
+
| 'nl'
|
|
141
|
+
| 'pl'
|
|
142
|
+
| 'pt'
|
|
143
|
+
| 'pt-BR'
|
|
144
|
+
| 'ro'
|
|
145
|
+
| 'ru'
|
|
146
|
+
| 'sk'
|
|
147
|
+
| 'sl'
|
|
148
|
+
| 'sv'
|
|
149
|
+
| 'th'
|
|
150
|
+
| 'tr'
|
|
151
|
+
| 'zh'
|
|
152
|
+
| 'zh-HK'
|
|
153
|
+
| 'zh-TW';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {CreateConfirmationToken} from '../api';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {CreateConfirmationToken} from '../api';
|
|
@@ -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
|
+
}
|