@stripe/stripe-js
Advanced tools
Comparing version 4.10.0 to 5.0.0
@@ -87,5 +87,2 @@ import {StripeElements} from '../stripe-js'; | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* Specifies if the PaymentMethod should be redisplayed when using the Saved Payment Method feature | ||
@@ -92,0 +89,0 @@ */ |
@@ -45,3 +45,3 @@ 'use strict'; | ||
name: 'stripe-js', | ||
version: "4.6.0", | ||
version: "4.10.0", | ||
startTime: startTime | ||
@@ -48,0 +48,0 @@ }); |
@@ -61,3 +61,3 @@ 'use strict'; | ||
name: 'stripe-js', | ||
version: "4.6.0", | ||
version: "4.10.0", | ||
startTime: startTime | ||
@@ -64,0 +64,0 @@ }); |
@@ -1,153 +0,489 @@ | ||
export interface RedirectToCheckoutServerOptions { | ||
/** | ||
* 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). | ||
*/ | ||
sessionId: string; | ||
import { | ||
LayoutObject, | ||
Layout, | ||
TermsOption, | ||
StripePaymentElement, | ||
} from './elements/payment'; | ||
import { | ||
AddressMode, | ||
ContactOption, | ||
StripeAddressElement, | ||
} from './elements/address'; | ||
import {Appearance, CssFontSource, CustomFontSource} from './elements-group'; | ||
import {StripeError} from './stripe'; | ||
import { | ||
StripeCurrencySelectorElement, | ||
FieldsOption, | ||
StripeElementBase, | ||
StripeExpressCheckoutElement, | ||
StripeExpressCheckoutElementConfirmEvent, | ||
StripeExpressCheckoutElementOptions, | ||
StripeExpressCheckoutElementReadyEvent, | ||
} from './elements'; | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
*/ | ||
export interface StripeCheckoutElementsOptions { | ||
appearance?: Appearance; | ||
loader?: 'auto' | 'always' | 'never'; | ||
fonts?: Array<CssFontSource | CustomFontSource>; | ||
} | ||
export interface RedirectToCheckoutClientOptions { | ||
/** | ||
* The URL to which Stripe should send customers when payment is complete. | ||
* 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). | ||
*/ | ||
successUrl: string; | ||
export interface StripeCheckoutOptions { | ||
clientSecret: string; | ||
elementsOptions?: StripeCheckoutElementsOptions; | ||
} | ||
/** | ||
* The URL to which Stripe should send customers when payment is canceled. | ||
*/ | ||
cancelUrl: string; | ||
/* Elements with CheckoutSessions API types */ | ||
export type StripeCheckoutAddress = { | ||
country: string; | ||
line1?: string | null; | ||
line2?: string | null; | ||
city?: string | null; | ||
postal_code?: string | null; | ||
state?: string | null; | ||
}; | ||
/** | ||
* An array of objects representing the items that your customer would like to purchase. | ||
* These items are shown as line items in the Checkout interface and make up the total amount to be collected by Checkout. | ||
*/ | ||
lineItems?: Array<{ | ||
/** | ||
* The ID of the price that the customer would like to purchase. SKU or plan IDs may also be used. | ||
*/ | ||
price?: string; | ||
export type StripeCheckoutAdjustableQuantity = { | ||
maximum: number; | ||
minimum: number; | ||
}; | ||
/** | ||
* The quantity of units for the item. | ||
*/ | ||
quantity?: number; | ||
}>; | ||
export type StripeCheckoutBillingInterval = 'day' | 'month' | 'week' | 'year'; | ||
/** | ||
* An array of objects representing the items that your customer would like to purchase. | ||
* These items are shown as line items in the Checkout interface and make up the total amount to be collected by Checkout. | ||
* | ||
* @deprecated | ||
*/ | ||
items?: Array<{ | ||
/** | ||
* The ID of the SKU that the customer would like to purchase | ||
*/ | ||
sku?: string; | ||
export type StripeCheckoutConfirmationRequirement = | ||
| 'phoneNumber' | ||
| 'shippingAddress' | ||
| 'billingAddress' | ||
| 'paymentDetails' | ||
| 'email'; | ||
/** | ||
* The ID of the plan that the customer would like to subscribe to. | ||
*/ | ||
plan?: string; | ||
export type StripeCheckoutContact = { | ||
name?: string | null; | ||
address: StripeCheckoutAddress; | ||
}; | ||
/** | ||
* The quantity of units for the item. | ||
*/ | ||
quantity?: number; | ||
}>; | ||
export type StripeCheckoutDeliveryEstimate = { | ||
maximum: StripeCheckoutEstimate | null; | ||
minimum: StripeCheckoutEstimate | null; | ||
}; | ||
export type StripeCheckoutDiscountAmount = { | ||
amount: number; | ||
displayName: string; | ||
promotionCode: string | null; | ||
recurring: | ||
| {type: 'forever'} | ||
| {type: 'repeating'; durationInMonths: number} | ||
| null; | ||
}; | ||
export type StripeCheckoutDueNext = { | ||
amountSubtotal: number; | ||
amountDiscount: number; | ||
amountTaxInclusive: number; | ||
amountTaxExclusive: number; | ||
billingCycleAnchor: number | null; | ||
}; | ||
export type StripeCheckoutEstimate = { | ||
unit: 'business_day' | 'day' | 'hour' | 'week' | 'month'; | ||
value: number; | ||
}; | ||
export type StripeCheckoutLastPaymentError = { | ||
message: string; | ||
}; | ||
export type StripeCheckoutRedirectBehavior = 'always' | 'if_required'; | ||
export type StripeCheckoutSavedPaymentMethod = { | ||
id: string; | ||
type: 'card'; | ||
card: { | ||
brand: string; | ||
expMonth: number; | ||
expYear: number; | ||
last4: string; | ||
}; | ||
billingDetails: { | ||
email?: string | null; | ||
name?: string | null; | ||
phone?: string | null; | ||
address?: { | ||
line1?: string | null; | ||
line2?: string | null; | ||
city?: string | null; | ||
postal_code?: string | null; | ||
state?: string | null; | ||
country?: string | null; | ||
} | null; | ||
}; | ||
}; | ||
export type StripeCheckoutTaxAmount = { | ||
amount: number; | ||
inclusive: boolean; | ||
displayName: string; | ||
}; | ||
export type StripeCheckoutLineItem = { | ||
id: string; | ||
name: string; | ||
amountDiscount: number; | ||
amountSubtotal: number; | ||
amountTaxExclusive: number; | ||
amountTaxInclusive: number; | ||
unitAmount: number; | ||
description: string | null; | ||
quantity: number; | ||
discountAmounts: Array<StripeCheckoutDiscountAmount> | null; | ||
taxAmounts: Array<StripeCheckoutTaxAmount> | null; | ||
recurring: { | ||
interval: StripeCheckoutBillingInterval; | ||
intervalCount: number; | ||
isProrated: boolean; | ||
usageType: 'metered' | 'licensed'; | ||
} | null; | ||
adjustableQuantity: StripeCheckoutAdjustableQuantity | null; | ||
images: string[]; | ||
}; | ||
export type StripeCheckoutRecurring = { | ||
interval: StripeCheckoutBillingInterval; | ||
intervalCount: number; | ||
dueNext: StripeCheckoutDueNext; | ||
trial: StripeCheckoutTrial | null; | ||
}; | ||
export type StripeCheckoutShipping = { | ||
shippingOption: StripeCheckoutShippingOption; | ||
taxAmounts: Array<StripeCheckoutTaxAmount> | null; | ||
}; | ||
export type StripeCheckoutShippingOption = { | ||
id: string; | ||
amount: number; | ||
currency: string; | ||
displayName: string | null; | ||
deliveryEstimate: StripeCheckoutDeliveryEstimate | null; | ||
}; | ||
export type StripeCheckoutStatus = | ||
| {type: 'open'} | ||
| {type: 'expired'} | ||
| { | ||
type: 'complete'; | ||
paymentStatus: 'paid' | 'unpaid' | 'no_payment_required'; | ||
}; | ||
export type StripeCheckoutTaxStatus = | ||
| {status: 'ready'} | ||
| {status: 'requires_shipping_address'} | ||
| {status: 'requires_billing_address'}; | ||
export type StripeCheckoutTotalSummary = { | ||
appliedBalance: number; | ||
balanceAppliedToNextInvoice: boolean; | ||
discount: number; | ||
shippingRate: number; | ||
subtotal: number; | ||
taxExclusive: number; | ||
taxInclusive: number; | ||
total: number; | ||
}; | ||
export type StripeCheckoutTrial = { | ||
trialEnd: number; | ||
trialPeriodDays: number; | ||
}; | ||
export type StripeCheckoutCurrencyOption = { | ||
amount: number; | ||
currency: string; | ||
currencyConversion?: {fxRate: number; sourceCurrency: string}; | ||
}; | ||
/* Custom Checkout session */ | ||
export interface StripeCheckoutSession { | ||
billingAddress: StripeCheckoutContact | null; | ||
businessName: string | null; | ||
canConfirm: boolean; | ||
confirmationRequirements: StripeCheckoutConfirmationRequirement[]; | ||
currency: string; | ||
currencyOptions: Array<StripeCheckoutCurrencyOption> | null; | ||
discountAmounts: Array<StripeCheckoutDiscountAmount> | null; | ||
email: string | null; | ||
id: string; | ||
lastPaymentError: StripeCheckoutLastPaymentError | null; | ||
lineItems: Array<StripeCheckoutLineItem>; | ||
livemode: boolean; | ||
phoneNumber: string | null; | ||
recurring: StripeCheckoutRecurring | null; | ||
savedPaymentMethods: Array<StripeCheckoutSavedPaymentMethod> | null; | ||
shipping: StripeCheckoutShipping | null; | ||
shippingAddress: StripeCheckoutContact | null; | ||
shippingOptions: Array<StripeCheckoutShippingOption>; | ||
status: StripeCheckoutStatus; | ||
tax: StripeCheckoutTaxStatus; | ||
taxAmounts: Array<StripeCheckoutTaxAmount> | null; | ||
total: StripeCheckoutTotalSummary; | ||
} | ||
export type StripeCheckoutResult = | ||
| {session: StripeCheckoutSession; error?: undefined} | ||
| {session?: undefined; error: StripeError}; | ||
export type StripeCheckoutPaymentElementOptions = { | ||
layout?: Layout | LayoutObject; | ||
paymentMethodOrder?: Array<string>; | ||
readonly?: boolean; | ||
terms?: TermsOption; | ||
fields?: FieldsOption; | ||
}; | ||
export type StripeCheckoutAddressElementOptions = { | ||
mode: AddressMode; | ||
contacts?: ContactOption[]; | ||
display?: { | ||
name?: 'full' | 'split' | 'organization'; | ||
}; | ||
}; | ||
export type StripeCheckoutExpressCheckoutElementOptions = { | ||
buttonHeight: StripeExpressCheckoutElementOptions['buttonHeight']; | ||
buttonTheme: StripeExpressCheckoutElementOptions['buttonTheme']; | ||
buttonType: StripeExpressCheckoutElementOptions['buttonType']; | ||
layout: StripeExpressCheckoutElementOptions['layout']; | ||
paymentMethodOrder: StripeExpressCheckoutElementOptions['paymentMethodOrder']; | ||
paymentMethods: StripeExpressCheckoutElementOptions['paymentMethods']; | ||
}; | ||
export type StripeCheckoutUpdateHandler = ( | ||
session: StripeCheckoutSession | ||
) => void; | ||
export type StripeCheckoutExpressCheckoutElement = StripeElementBase & { | ||
/** | ||
* The mode of the Checkout Session. Required if using lineItems. | ||
* Triggered when the element is fully rendered. | ||
*/ | ||
mode?: 'payment' | 'subscription'; | ||
on( | ||
eventType: 'ready', | ||
handler: (event: StripeExpressCheckoutElementReadyEvent) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
once( | ||
eventType: 'ready', | ||
handler: (event: StripeExpressCheckoutElementReadyEvent) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
off( | ||
eventType: 'ready', | ||
handler?: (event: StripeExpressCheckoutElementReadyEvent) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
/** | ||
* A unique string to reference the Checkout session. | ||
* This can be a customer ID, a cart ID, or similar. | ||
* It is included in the `checkout.session.completed` webhook and can be used to fulfill the purchase. | ||
* Triggered when the element gains focus. | ||
*/ | ||
clientReferenceId?: string; | ||
on( | ||
eventType: 'focus', | ||
handler: (event: {elementType: 'expressCheckout'}) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
once( | ||
eventType: 'focus', | ||
handler: (event: {elementType: 'expressCheckout'}) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
off( | ||
eventType: 'focus', | ||
handler?: (event: {elementType: 'expressCheckout'}) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
/** | ||
* The email address used to create the customer object. | ||
* If you already know your customer's email address, use this attribute to prefill it on Checkout. | ||
* Triggered when the element loses focus. | ||
*/ | ||
customerEmail?: string; | ||
on( | ||
eventType: 'blur', | ||
handler: (event: {elementType: 'expressCheckout'}) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
once( | ||
eventType: 'blur', | ||
handler: (event: {elementType: 'expressCheckout'}) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
off( | ||
eventType: 'blur', | ||
handler?: (event: {elementType: 'expressCheckout'}) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
/** | ||
* Specify whether Checkout should collect the customer’s billing address. | ||
* If set to `required`, Checkout will attempt to collect the customer’s billing address. | ||
* If not set or set to `auto` Checkout will only attempt to collect the billing address when necessary. | ||
* Triggered when the escape key is pressed within the element. | ||
*/ | ||
billingAddressCollection?: 'auto' | 'required'; | ||
on( | ||
eventType: 'escape', | ||
handler: (event: {elementType: 'expressCheckout'}) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
once( | ||
eventType: 'escape', | ||
handler: (event: {elementType: 'expressCheckout'}) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
off( | ||
eventType: 'escape', | ||
handler?: (event: {elementType: 'expressCheckout'}) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
/** | ||
* Provides configuration for Checkout to collect a shipping address from a customer. | ||
* Triggered when the element fails to load. | ||
*/ | ||
shippingAddressCollection?: { | ||
/** | ||
* An array of two-letter ISO country codes representing which countries | ||
* Checkout should provide as options for shipping locations. The codes are | ||
* expected to be uppercase. Unsupported country codes: AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI. | ||
*/ | ||
allowedCountries: string[]; | ||
}; | ||
on( | ||
eventType: 'loaderror', | ||
handler: (event: { | ||
elementType: 'expressCheckout'; | ||
error: StripeError; | ||
}) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
once( | ||
eventType: 'loaderror', | ||
handler: (event: { | ||
elementType: 'expressCheckout'; | ||
error: StripeError; | ||
}) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
off( | ||
eventType: 'loaderror', | ||
handler?: (event: { | ||
elementType: 'expressCheckout'; | ||
error: StripeError; | ||
}) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
/** | ||
* The [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) of the locale to display Checkout in. | ||
* Default is `auto` (Stripe detects the locale of the browser). | ||
* Triggered when a buyer authorizes a payment within a supported payment method. | ||
*/ | ||
locale?: CheckoutLocale; | ||
on( | ||
eventType: 'confirm', | ||
handler: (event: StripeExpressCheckoutElementConfirmEvent) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
once( | ||
eventType: 'confirm', | ||
handler: (event: StripeExpressCheckoutElementConfirmEvent) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
off( | ||
eventType: 'confirm', | ||
handler?: (event: StripeExpressCheckoutElementConfirmEvent) => any | ||
): StripeCheckoutExpressCheckoutElement; | ||
/** | ||
* Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the **Submit** button. | ||
* `submitType` can only be specified when using using line items or SKUs, and not subscriptions. | ||
* The default is `auto`. | ||
* Updates the options the `ExpressCheckoutElement` was initialized with. | ||
* Updates are merged into the existing configuration. | ||
*/ | ||
submitType?: 'auto' | 'book' | 'donate' | 'pay'; | ||
} | ||
update: StripeExpressCheckoutElement['update']; | ||
}; | ||
export type RedirectToCheckoutOptions = | ||
| RedirectToCheckoutServerOptions | ||
| RedirectToCheckoutClientOptions; | ||
type AnyBuyerError = {message: string; code: null}; | ||
type ApplyPromotionCodeError = | ||
| {message: string; code: 'invalidCode'} | ||
| AnyBuyerError; | ||
export type StripeCheckoutApplyPromotionCodeResult = | ||
| {type: 'success'; success: StripeCheckoutSession} | ||
| {type: 'error'; error: ApplyPromotionCodeError}; | ||
export type CheckoutLocale = | ||
| 'auto' | ||
| 'bg' | ||
| 'cs' | ||
| 'da' | ||
| 'de' | ||
| 'el' | ||
| 'en' | ||
| 'en-GB' | ||
| 'es' | ||
| 'es-419' | ||
| 'et' | ||
| 'fi' | ||
| 'fil' | ||
| 'fr' | ||
| 'fr-CA' | ||
| 'hr' | ||
| 'hu' | ||
| 'id' | ||
| 'it' | ||
| 'ja' | ||
| 'lt' | ||
| 'lv' | ||
| 'ms' | ||
| 'mt' | ||
| 'nb' | ||
| 'nl' | ||
| 'pl' | ||
| 'pt' | ||
| 'pt-BR' | ||
| 'ro' | ||
| 'ru' | ||
| 'sk' | ||
| 'sl' | ||
| 'sv' | ||
| 'th' | ||
| 'tr' | ||
| 'zh' | ||
| 'zh-HK' | ||
| 'zh-TW'; | ||
export type StripeCheckoutRemovePromotionCodeResult = | ||
| {type: 'success'; success: StripeCheckoutSession} | ||
| {type: 'error'; error: AnyBuyerError}; | ||
export type StripeCheckoutUpdateAddressResult = | ||
| {type: 'success'; success: StripeCheckoutSession} | ||
| {type: 'error'; error: AnyBuyerError}; | ||
export type StripeCheckoutUpdatePhoneNumberResult = | ||
| {type: 'success'; success: StripeCheckoutSession} | ||
| {type: 'error'; error: never}; | ||
type UpdateEmailError = | ||
| {message: string; code: 'incompleteEmail'} | ||
| {message: string; code: 'invalidEmail'}; | ||
export type StripeCheckoutUpdateEmailResult = | ||
| {type: 'success'; success: StripeCheckoutSession} | ||
| {type: 'error'; error: UpdateEmailError}; | ||
export type StripeCheckoutUpdateLineItemQuantityResult = | ||
| {type: 'success'; success: StripeCheckoutSession} | ||
| {type: 'error'; error: AnyBuyerError}; | ||
export type StripeCheckoutUpdateShippingOptionResult = | ||
| {type: 'success'; success: StripeCheckoutSession} | ||
| {type: 'error'; error: AnyBuyerError}; | ||
type ConfirmError = | ||
| { | ||
message: string; | ||
code: 'paymentFailed'; | ||
paymentFailed: { | ||
declineCode: string | null; | ||
}; | ||
} | ||
| AnyBuyerError; | ||
export type StripeCheckoutConfirmResult = | ||
| {type: 'success'; success: StripeCheckoutSession} | ||
| {type: 'error'; error: ConfirmError}; | ||
export interface StripeCheckout { | ||
/* Custom Checkout methods */ | ||
applyPromotionCode: ( | ||
promotionCode: string | ||
) => Promise<StripeCheckoutApplyPromotionCodeResult>; | ||
removePromotionCode: () => Promise<StripeCheckoutRemovePromotionCodeResult>; | ||
updateShippingAddress: ( | ||
shippingAddress: StripeCheckoutContact | null | ||
) => Promise<StripeCheckoutUpdateAddressResult>; | ||
updateBillingAddress: ( | ||
billingAddress: StripeCheckoutContact | null | ||
) => Promise<StripeCheckoutUpdateAddressResult>; | ||
updatePhoneNumber: ( | ||
phoneNumber: string | ||
) => Promise<StripeCheckoutUpdatePhoneNumberResult>; | ||
updateEmail: (email: string) => Promise<StripeCheckoutUpdateEmailResult>; | ||
updateLineItemQuantity: (args: { | ||
lineItem: string; | ||
quantity: number; | ||
}) => Promise<StripeCheckoutUpdateLineItemQuantityResult>; | ||
updateShippingOption: ( | ||
shippingOption: string | ||
) => Promise<StripeCheckoutResult>; | ||
confirm: (args?: { | ||
returnUrl?: string; | ||
redirect?: StripeCheckoutRedirectBehavior; | ||
paymentMethod?: string; | ||
savePaymentMethod?: boolean; | ||
}) => Promise<StripeCheckoutConfirmResult>; | ||
session: () => StripeCheckoutSession; | ||
on: (event: 'change', handler: StripeCheckoutUpdateHandler) => void; | ||
/* Elements methods */ | ||
changeAppearance: (appearance: Appearance) => void; | ||
getElement(elementType: 'payment'): StripePaymentElement | null; | ||
getElement( | ||
elementType: 'address', | ||
mode: AddressMode | ||
): StripeAddressElement | null; | ||
getElement( | ||
elementType: 'expressCheckout' | ||
): StripeCheckoutExpressCheckoutElement | null; | ||
/* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */ | ||
getElement( | ||
elementType: 'currencySelector' | ||
): StripeCurrencySelectorElement | null; | ||
createElement( | ||
elementType: 'payment', | ||
options?: StripeCheckoutPaymentElementOptions | ||
): StripePaymentElement; | ||
createElement( | ||
elementType: 'address', | ||
options: StripeCheckoutAddressElementOptions | ||
): StripeAddressElement; | ||
createElement( | ||
elementType: 'expressCheckout', | ||
options: StripeCheckoutExpressCheckoutElementOptions | ||
): StripeCheckoutExpressCheckoutElement; | ||
/* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */ | ||
createElement(elementType: 'currencySelector'): StripeCurrencySelectorElement; | ||
} |
import { | ||
StripeAddressElement, | ||
StripeAddressElementOptions, | ||
StripeCurrencySelectorElement, | ||
StripeShippingAddressElement, | ||
@@ -71,3 +72,6 @@ StripeShippingAddressElementOptions, | ||
*/ | ||
submit(): Promise<{error?: StripeError}>; | ||
submit(): Promise< | ||
| {error?: StripeError; selectedPaymentMethod?: undefined} | ||
| {selectedPaymentMethod: string; error?: undefined} | ||
>; | ||
@@ -336,5 +340,2 @@ ///////////////////////////// | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* Creates a `LinkAuthenticationElement`. | ||
@@ -348,5 +349,2 @@ */ | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* Looks up a previously created `Element` by its type. | ||
@@ -506,2 +504,3 @@ */ | ||
| 'cardCvc' | ||
| 'currencySelector' | ||
| 'epsBank' | ||
@@ -538,2 +537,3 @@ | 'expressCheckout' | ||
| StripeP24BankElement | ||
| StripeCurrencySelectorElement | ||
| StripeExpressCheckoutElement | ||
@@ -678,2 +678,10 @@ | StripePaymentElement | ||
customerSessionClientSecret?: string; | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* Display Custom Payment Methods in the Payment Element that you are already registered with. | ||
*/ | ||
customPaymentMethods?: CustomPaymentMethod[]; | ||
} | ||
@@ -1137,1 +1145,23 @@ | ||
} | ||
export interface CustomPaymentMethod { | ||
/** | ||
* The Custom Payment Method id, prefixed with `cpmt_`. | ||
*/ | ||
id: string; | ||
/** | ||
* Additional options to configure the Custom Payment Method. | ||
*/ | ||
options: { | ||
/** | ||
* The payment form type. | ||
*/ | ||
type: 'static'; | ||
/** | ||
* Display additional information about the payment method, max 100 characters. | ||
*/ | ||
subtitle?: string; | ||
}; | ||
} |
@@ -377,4 +377,7 @@ import {StripeElementBase} from './base'; | ||
export type AvailablePaymentMethods = { | ||
amazonPay: boolean; | ||
applePay: boolean; | ||
googlePay: boolean; | ||
link: boolean; | ||
paypal: boolean; | ||
}; | ||
@@ -381,0 +384,0 @@ |
@@ -11,2 +11,3 @@ export * from './address'; | ||
export * from './card'; | ||
export * from './currency-selector'; | ||
export * from './eps-bank'; | ||
@@ -13,0 +14,0 @@ export * from './express-checkout'; |
@@ -120,2 +120,27 @@ import {StripeElementBase} from './base'; | ||
/** | ||
* The change event is triggered when the `Element`'s value changes. | ||
* Represents the details of a selected Card payment method. | ||
*/ | ||
on( | ||
eventType: 'carddetailschange', | ||
handler: (event: StripePaymentElementCardDetailsChangeEvent) => any | ||
): StripePaymentElement; | ||
/** | ||
* Triggered when a Saved Payment Method is updated. | ||
*/ | ||
on( | ||
eventType: 'savedpaymentmethodupdate', | ||
handler: (event: StripePaymentElementSavedPaymentMethodUpdateEvent) => any | ||
): StripePaymentElement; | ||
/** | ||
* Triggered when a Saved Payment Method is removed. | ||
*/ | ||
on( | ||
eventType: 'savedpaymentmethodremove', | ||
handler: (event: StripePaymentElementSavedPaymentMethodRemoveEvent) => any | ||
): StripePaymentElement; | ||
/** | ||
* Updates the options the `PaymentElement` was initialized with. | ||
@@ -162,2 +187,3 @@ * Updates are merged into the existing configuration. | ||
| FieldOption | ||
| 'if_required' | ||
| { | ||
@@ -204,2 +230,3 @@ country?: FieldOption; | ||
spacedAccordionItems?: boolean; | ||
visibleAccordionItemsCount?: number; | ||
} | ||
@@ -303,1 +330,110 @@ | ||
} | ||
type CardBrand = | ||
| 'amex' | ||
| 'diners' | ||
| 'discover' | ||
| 'eftpos_au' | ||
| 'jcb' | ||
| 'mastercard' | ||
| 'unionpay' | ||
| 'visa' | ||
| 'unknown'; | ||
type CardFunding = 'credit' | 'debit' | 'prepaid' | 'unknown'; | ||
export interface StripePaymentElementCardDetailsChangeEvent { | ||
/** | ||
* The type of element that emitted this event. | ||
*/ | ||
elementType: 'payment'; | ||
/** | ||
* `true` when the card details are loading. | ||
*/ | ||
loading: boolean; | ||
/** | ||
* The card details for the selected payment method. | ||
* Undefined while loading and for non card payment methods. | ||
*/ | ||
details?: { | ||
brands: CardBrand[] | null; | ||
funding: CardFunding | null; | ||
}; | ||
} | ||
export interface StripePaymentElementSavedPaymentMethodUpdateEvent { | ||
/** | ||
* The type of element that emitted this event. | ||
*/ | ||
elementType: 'payment'; | ||
/** | ||
* `true` when the saved payment method is successfully updated. | ||
*/ | ||
success: boolean; | ||
/** | ||
* Error message if the saved payment method update fails. | ||
*/ | ||
error?: string; | ||
/** | ||
* The updated saved payment method. | ||
*/ | ||
payment_method: { | ||
id: string; | ||
type: string; | ||
billing_details: { | ||
address: { | ||
city: null | string; | ||
country: null | string; | ||
line1: null | string; | ||
line2: null | string; | ||
postal_code: null | string; | ||
state: null | string; | ||
}; | ||
name: null | string; | ||
email: null | string; | ||
phone: null | string; | ||
}; | ||
}; | ||
} | ||
export interface StripePaymentElementSavedPaymentMethodRemoveEvent { | ||
/** | ||
* The type of element that emitted this event. | ||
*/ | ||
elementType: 'payment'; | ||
/** | ||
* `true` when the saved payment method is successfully removed. | ||
*/ | ||
success: boolean; | ||
/** | ||
* Error message if the saved payment method removal fails. | ||
*/ | ||
error?: string; | ||
/** | ||
* The removed saved payment method. | ||
*/ | ||
payment_method: { | ||
id: string; | ||
type: string; | ||
billing_details: { | ||
address: { | ||
city: null | string; | ||
country: null | string; | ||
line1: null | string; | ||
line2: null | string; | ||
postal_code: null | string; | ||
state: null | string; | ||
}; | ||
name: null | string; | ||
email: null | string; | ||
phone: null | string; | ||
}; | ||
}; | ||
} |
@@ -20,2 +20,25 @@ export type StripeEmbeddedCheckoutAddress = { | ||
export type StripeEmbeddedCheckoutLineItem = { | ||
id?: string; | ||
quantity?: number; | ||
price?: string; | ||
display?: { | ||
name?: string; | ||
description?: string; | ||
images?: string[]; | ||
}; | ||
pricingSpec?: { | ||
unitAmount?: number; | ||
unitAmountDecimal?: string; | ||
currency?: string; | ||
taxBehavior?: 'inclusive' | 'exclusive' | 'unspecified'; | ||
taxCode?: string; | ||
}; | ||
}; | ||
export type StripeEmbeddedCheckoutLineItemsChangeEvent = { | ||
checkoutSessionId: string; | ||
lineItems: StripeEmbeddedCheckoutLineItem[]; | ||
}; | ||
export type ResultAction = | ||
@@ -49,2 +72,9 @@ | {type: 'accept'} | ||
) => Promise<ResultAction>; | ||
/** | ||
* onLineItemsChange is called when the customer adds, removes, or modifies a line item. | ||
* The callback is required when [permissions.update.line_items](https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-permissions-update-line_items) is set to `server_only`. | ||
*/ | ||
onLineItemsChange?: ( | ||
event: StripeEmbeddedCheckoutLineItemsChangeEvent | ||
) => Promise<ResultAction>; | ||
} | ||
@@ -51,0 +81,0 @@ |
@@ -0,3 +1,3 @@ | ||
export * from './hosted-checkout'; | ||
export * from './checkout'; | ||
export * from './custom-checkout'; | ||
export * from './embedded-checkout'; | ||
@@ -4,0 +4,0 @@ export * from './elements'; |
@@ -272,2 +272,17 @@ import { | ||
export interface CreatePaymentMethodMultibancoData | ||
extends PaymentMethodCreateParams { | ||
type: 'multibanco'; | ||
/** | ||
* The customer's billing details. | ||
* `email` is required. | ||
* | ||
* @docs https://stripe.com/docs/api/payment_methods/create#create_payment_method-billing_details | ||
*/ | ||
billing_details: PaymentMethodCreateParams.BillingDetails & { | ||
email: string; | ||
}; | ||
} | ||
export interface CreatePaymentMethodOxxoData extends PaymentMethodCreateParams { | ||
@@ -374,2 +389,7 @@ type: 'oxxo'; | ||
export interface CreatePaymentMethodTwintData | ||
extends PaymentMethodCreateParams { | ||
type: 'twint'; | ||
} | ||
export interface CreatePaymentMethodAuBecsDebitData | ||
@@ -1082,2 +1102,32 @@ extends PaymentMethodCreateParams { | ||
/** | ||
* Data to be sent with a `stripe.confirmMultibancoPayment` request. | ||
* Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters. | ||
*/ | ||
export interface ConfirmMultibancoPaymentData | ||
extends PaymentIntentConfirmParams { | ||
/** | ||
* Either the `id` of an existing [PaymentMethod](https://stripe.com/docs/api/payment_methods), or an object containing data to create a `PaymentMethod` with. | ||
* This field is optional if a `PaymentMethod` has already been attached to this `PaymentIntent`. | ||
* | ||
* @recommended | ||
*/ | ||
payment_method?: string | Omit<CreatePaymentMethodMultibancoData, 'type'>; | ||
/** | ||
* The url your customer will be directed to after they complete authentication. | ||
* | ||
* @recommended | ||
*/ | ||
return_url?: string; | ||
} | ||
export interface ConfirmMultibancoPaymentOptions { | ||
/** | ||
* Set this to `false` if you want to [manually handle the authorization redirect](https://stripe.com/docs/payments/sofort/accept-a-payment?platform=web#handle-redirect). | ||
* Default is `true`. | ||
*/ | ||
handleActions?: boolean; | ||
} | ||
/** | ||
* Data to be sent with a `stripe.confirmOxxoPayment` request. | ||
@@ -1285,2 +1335,31 @@ * Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters. | ||
/** | ||
* Data to be sent with a `stripe.confirmTwintPayment` request. | ||
* Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters. | ||
*/ | ||
export interface ConfirmTwintPaymentData extends PaymentIntentConfirmParams { | ||
/** | ||
* Either the `id` of an existing [PaymentMethod](https://stripe.com/docs/api/payment_methods), or an object containing data to create a `PaymentMethod` with. | ||
* This field is optional if a `PaymentMethod` has already been attached to this `PaymentIntent`. | ||
* | ||
* @recommended | ||
*/ | ||
payment_method?: string | Omit<CreatePaymentMethodTwintData, 'type'>; | ||
/** | ||
* The url your customer will be directed to after they complete authentication. | ||
* | ||
* @recommended | ||
*/ | ||
return_url?: string; | ||
} | ||
export interface ConfirmTwintPaymentOptions { | ||
/** | ||
* Set this to `false` if you want to [manually handle the authorization redirect](https://stripe.com/docs/payments/sofort/accept-a-payment?platform=web#handle-redirect). | ||
* Default is `true`. | ||
*/ | ||
handleActions?: boolean; | ||
} | ||
/** | ||
* Data to be sent with a `stripe.confirmWechatPayPayment` request. | ||
@@ -1467,5 +1546,2 @@ * Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters. | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* Specifies if the PaymentMethod should be redisplayed when using the Saved Payment Method feature | ||
@@ -1472,0 +1548,0 @@ */ |
@@ -45,5 +45,2 @@ import {PaymentMethodCreateParams, SetupIntentConfirmParams} from '../api'; | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* Specifies if the PaymentMethod should be redisplayed when using the Saved Payment Method feature | ||
@@ -50,0 +47,0 @@ */ |
{ | ||
"name": "@stripe/stripe-js", | ||
"version": "4.10.0", | ||
"version": "5.0.0", | ||
"description": "Stripe.js loading utility", | ||
@@ -5,0 +5,0 @@ "repository": "github:stripe/stripe-js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
923545
141
13140