The Element Use Element instances to collect sensitive information in your checkout flow. ## The Payment Element The Payment Element is an embeddable component for securely collecting payment details. The Payment Element supports dozens of payment methods with a single integration. ## Create the Payment Element elements.create(type: 'payment', options?: object) This method creates an instance of the Payment Element. - type The type of Element being created, which is payment in this case. - options Options for creating the Payment Element. - layout Specify the layout for the Payment Element. If you only pass a layout type ('accordion' or ‘tabs’) without any additional parameters, the Payment Element renders using that layout and the default values associated with it. An object can also be passed to specify the layout with additional configuration. - type Defines the layout to render the Payment Element. - defaultCollapsed Controls if the Payment Element renders in a collapsed state (where no payment method is selected by default). When you leave this undefined, Stripe renders the experience that it determines will have the best conversion. - radios Controls when to render each Payment Method with a radio input next to its logo. The radios visually indicate the current selection of the Payment Element. Defaults to 'auto'. - 'always' — Always show radio inputs. - 'never' — Never show radio inputs. - 'if_multiple' — Show radio inputs only when there are multiple payment methods available. When there is only one payment method, no radio input is displayed. - 'auto' — Stripe determines the best experience to optimize conversion. This property is only applicable to the accordion layout. - spacedAccordionItems When true, the Payment Methods render as standalone buttons with space in between them. This property is only applicable to the accordion layout. - visibleAccordionItemsCount Sets the max number of Payment Methods visible before using the "More" button to hide additional Payment Methods. Set this value to 0 to disable the "More" button and render all available Payment Methods. Default is 5. This property is only applicable to the accordion layout. - paymentMethodLogoPosition Sets the position of the payment method logo in each accordion item. Default is start. This property is only applicable to the accordion layout. - defaultValues Provide initial customer information that will be displayed in the Payment Element. The form will render with empty fields if not provided. - billingDetails Specify customer's billing details, which lets you pre-fill a customer’s name, email, phone number and address if required by payment method. Pre-filling as much information as possible streamlines the checkout process. - name - email - phone - address - line1 - line2 - city The name of a city, town, village, etc. - state The most coarse subdivision of a country. Depending on the country, this might correspond to a state, a province, an oblast, a prefecture, or something else along these lines. - country Two-letter country code, capitalized. Valid two-letter country codes are specified by the related setting alpha-2. - postal_code The postal code or ZIP code, also known as PIN code in India. - paymentMethods Specify customer's default information for different payment methods. Pre-filling as much information as possible streamlines the checkout process. - ideal - bank A pre-filled iDEAL bank value for the Payment Element. Can only be one of the banks listed in the iDEAL guide (e.g., abn_amro). - payto - usePayId When true, the PayTo payment method will default to showing the PayID input instead of BSB/account number fields. Customers can still switch between PayID and BSB/account number using the toggle link. - card Specify default settings for card payments. - network Specifies a network preference for Card Brand Choice. The first network in the array that matches a network on the entered co-branded card will be selected by default in the Card Brand Choice dropdown. See the supported networks for valid values. - business Provide information about your business that will be displayed in the Payment Element. This information will be retrieved from your Stripe account if not provided. - name The name of your business. Your business name will be used to render mandate text for some payment methods. - paymentMethodOrder By default, the Payment Element will use a dynamic ordering that optimizes payment method display for each user. You can override the default order in which payment methods are displayed in the Payment Element with a list of payment method types. If the associated PaymentIntent has payment method types not specified in paymentMethodOrder, they will be displayed after the payment methods you specify. If you specify payment method types not on the associated PaymentIntent, they will be ignored. - fields By default, the Payment Element collects all necessary details to complete a payment. For some payment methods, the Payment Element collects details such as name or email that you might have already collected from the customer. If this is the case, you can prevent the Payment Element from collecting these details by using the fields option. If you disable collecting certain fields with the fields option, you must pass that same data to stripe.confirmPayment or we'll reject the payment. You can set billingDetails at the top level to apply the same field collection settings to all payment methods, or set billingDetails under a supported payment method type to override the top-level setting for that payment method. Learn how to customize the billing details to collect and the customized fields. - billingDetails Specify never to avoid collecting all billing details in the Payment Element. If you would like to disable only certain billing details, pass an object specifying which fields you would like to disable collection for. The default setting for each field or object is auto. - name Specify always to require the Payment Element to collect the customer's billing name. - email Specify never to avoid collecting email in the Payment Element. Note that this parameter is independent of walletOptions, so if you set fields.billingDetails.email=never and walletOptions.emailRequired=true, email is still collected from wallets. - phone Specify never to avoid collecting phone in the Payment Element. Note that this parameter is independent of walletOptions, so if you set fields.billingDetails.phone=never and walletOptions.phoneNumberRequired=true, phone is still collected from wallets. - address Specify if_required to only collect the minimum billing address fields required to complete the payment. You can omit and hide optional address fields in the card form, such as country and postal code. Unlike the never option, you don't need to include fields omitted in the Payment Element when confirming the payment. This can reduce the amount of information required to complete the form. Disabling address collection can negatively impact authorization rates and network fees for users on a network cost plus pricing plan. - line1 - line2 - city The name of a city, town, village, etc. - state The most coarse subdivision of a country. Depending on the country, this might correspond to a state, a province, an oblast, a prefecture, or something else along these lines. - country Two-letter country code, capitalized. Valid two-letter country codes are specified by the related setting alpha-2. - postalCode The postal code or ZIP code, also known as PIN code in India. - [paymentMethodType] Optionally specify the billing detail collection settings for any Payment Element payment method type. Examples of valid values are card, klarna, or us_bank_account. You can include one or more payment method type keys. - billingDetails Specify never to avoid collecting all billing details in the Payment Element. If you would like to disable only certain billing details, pass an object specifying which fields you would like to disable collection for. The default setting for each field or object is auto. - name Specify always to require the Payment Element to collect the customer's billing name. - email Specify never to avoid collecting email in the Payment Element. Note that this parameter is independent of walletOptions, so if you set fields.billingDetails.email=never and walletOptions.emailRequired=true, email is still collected from wallets. - phone Specify never to avoid collecting phone in the Payment Element. Note that this parameter is independent of walletOptions, so if you set fields.billingDetails.phone=never and walletOptions.phoneNumberRequired=true, phone is still collected from wallets. - address Specify if_required to only collect the minimum billing address fields required to complete the payment. You can omit and hide optional address fields in the card form, such as country and postal code. Unlike the never option, you don't need to include fields omitted in the Payment Element when confirming the payment. This can reduce the amount of information required to complete the form. Disabling address collection can negatively impact authorization rates and network fees for users on a network cost plus pricing plan. - line1 - line2 - city The name of a city, town, village, etc. - state The most coarse subdivision of a country. Depending on the country, this might correspond to a state, a province, an oblast, a prefecture, or something else along these lines. - country Two-letter country code, capitalized. Valid two-letter country codes are specified by the related setting alpha-2. - postalCode The postal code or ZIP code, also known as PIN code in India. - readOnly Applies a read-only state to the Payment Element so that payment details can’t be changed. Default is false. Enabling the readOnly option doesn't change the Payment Element's visual appearance. If you want to adjust the way the Payment Element looks, use the Appearance API. - terms Control how mandates or other legal agreements are displayed in the Payment Element. Use never to never display legal agreements. The default setting is auto, which causes legal agreements to only be shown when necessary. Consult your legal and compliance advisors before making any changes to the text of mandates or legal agreements. You can't use the terms option to violate obligations under your Stripe agreement, Stripe policies, applicable laws or scheme rules. - applePay - auBecsDebit - bancontact - card - cashapp - googlePay - ideal - paypal - sepaDebit - sofort - usBankAccount - wallets By default, the Payment Element will display all the payment methods that the underlying Payment Intent was created with. However, wallets like Apple Pay and Google Pay are not payment methods per the Payment Intent API. They will show when the Payment Intent has the card payment method and the customer is using a supported platform and have an active card in their account. This is the auto behavior, and it is the default for choice for all wallets. If you do not want to show a given wallet as a payment option, you can set its property in wallets to never. - applePay - googlePay - link - walletOptions Options to control the information collected from the customer when paying with a wallet payment method. - emailRequired Collect the customer's email from wallet payment methods by setting this option to true. - phoneNumberRequired Collect the customer's phone number from wallet payment methods by setting this option to true. PayPal doesn't provide a phone number, even when this option is set to true. Google Pay makes a best effort to return the phone number registered to the wallet, but doesn't guarantee it will be provided in all cases. Link makes a best effort to return the phone number registered to the wallet, but doesn't guarantee it will be provided in all cases. - applePay Specify Apple Pay specific options. These are passed through to the Apple Pay API. - recurringPaymentRequest Specify a request to set up a recurring payment. See the Apple Pay documentation for more details. - paymentDescription - managementURL - regularBilling - amount - label - recurringPaymentStartDate - recurringPaymentEndDate - recurringPaymentIntervalUnit - recurringPaymentIntervalCount - trialBilling - amount - label - recurringPaymentStartDate - recurringPaymentEndDate - recurringPaymentIntervalUnit - recurringPaymentIntervalCount - billingAgreement - deferredPaymentRequest Specify a request to set up a deferred payment. See the Apple Pay documentation for more details. - paymentDescription - managementURL - deferredBilling - amount - amountType Indicates whether the billing amount is known at request time. When set to 'final', the Apple Pay payment sheet shows the configured amount. - label - deferredPaymentDate - billingAgreement - freeCancellationDate If set, you must also supply a freeCancellationDateTimeZone., - freeCancellationDateTimeZone "If set, you must also supply a freeCancellationDate., - automaticReloadPaymentRequest Specify a request to set up an automatic reload payment. See the Apple Pay documentation for more details. - paymentDescription - managementURL - automaticReloadBilling - amount - label - automaticReloadPaymentThresholdAmount - billingAgreement ### with customized fields ### Option parameter - fields Pass an object to specify payment fields you don't want to collect with the Payment Element. - billingDetails Specify never to avoid collecting all billing details in the Payment Element. If you would like to disable only certain billing details, pass an object specifying which fields you would like to disable collection for. The default setting for each field or object is auto. - name Specify always to require the Payment Element to collect the customer's billing name. - email Specify never to avoid collecting email in the Payment Element. Note that this parameter is independent of walletOptions, so if you set fields.billingDetails.email=never and walletOptions.emailRequired=true, email is still collected from wallets. - phone Specify never to avoid collecting phone in the Payment Element. Note that this parameter is independent of walletOptions, so if you set fields.billingDetails.phone=never and walletOptions.phoneNumberRequired=true, phone is still collected from wallets. - address Specify if_required to only collect the minimum billing address fields required to complete the payment. You can omit and hide optional address fields in the card form, such as country and postal code. Unlike the never option, you don't need to include fields omitted in the Payment Element when confirming the payment. This can reduce the amount of information required to complete the form. Disabling address collection can negatively impact authorization rates and network fees for users on a network cost plus pricing plan. - line1 - line2 - city The name of a city, town, village, etc. - state The most coarse subdivision of a country. Depending on the country, this might correspond to a state, a province, an oblast, a prefecture, or something else along these lines. - country Two-letter country code, capitalized. Valid two-letter country codes are specified by the related setting alpha-2. - postalCode The postal code or ZIP code, also known as PIN code in India. - [paymentMethodType] Optionally specify the billing detail collection settings for any Payment Element payment method type. Examples of valid values are card, klarna, or us_bank_account. You can include one or more payment method type keys. - billingDetails Specify never to avoid collecting all billing details in the Payment Element. If you would like to disable only certain billing details, pass an object specifying which fields you would like to disable collection for. The default setting for each field or object is auto. - name Specify always to require the Payment Element to collect the customer's billing name. - email Specify never to avoid collecting email in the Payment Element. Note that this parameter is independent of walletOptions, so if you set fields.billingDetails.email=never and walletOptions.emailRequired=true, email is still collected from wallets. - phone Specify never to avoid collecting phone in the Payment Element. Note that this parameter is independent of walletOptions, so if you set fields.billingDetails.phone=never and walletOptions.phoneNumberRequired=true, phone is still collected from wallets. - address Specify if_required to only collect the minimum billing address fields required to complete the payment. You can omit and hide optional address fields in the card form, such as country and postal code. Unlike the never option, you don't need to include fields omitted in the Payment Element when confirming the payment. This can reduce the amount of information required to complete the form. Disabling address collection can negatively impact authorization rates and network fees for users on a network cost plus pricing plan. - line1 - line2 - city The name of a city, town, village, etc. - state The most coarse subdivision of a country. Depending on the country, this might correspond to a state, a province, an oblast, a prefecture, or something else along these lines. - country Two-letter country code, capitalized. Valid two-letter country codes are specified by the related setting alpha-2. - postalCode The postal code or ZIP code, also known as PIN code in India. ### Example title Create a Payment Element with customized fields ### Example title Create a Payment Element ## Get a Payment Element elements.getElement(type: 'payment') This method retrieves a previously created Payment Element. - type The type of Element being retrieved, which is payment in this case. ### Example title Get a Payment Element ## Update a Payment Element element.update(options: object) Updates the options the Payment Element was initialized with. Updates are merged into the existing configuration with a shallow merge. NOTE: Don't use element.update() to fetch updates from a PaymentIntent or SetupIntent. Use elements.fetchUpdates() instead. - options Options for updating the Payment Element. - layout Specify the layout for the Payment Element. If you only pass a layout type ('accordion' or ‘tabs’) without any additional parameters, the Payment Element renders using that layout and the default values associated with it. An object can also be passed to specify the layout with additional configuration. - type Defines the layout to render the Payment Element. - defaultCollapsed Controls if the Payment Element renders in a collapsed state (where no payment method is selected by default). When you leave this undefined, Stripe renders the experience that it determines will have the best conversion. - radios Controls when to render each Payment Method with a radio input next to its logo. The radios visually indicate the current selection of the Payment Element. Defaults to 'auto'. - 'always' — Always show radio inputs. - 'never' — Never show radio inputs. - 'if_multiple' — Show radio inputs only when there are multiple payment methods available. When there is only one payment method, no radio input is displayed. - 'auto' — Stripe determines the best experience to optimize conversion. This property is only applicable to the accordion layout. - spacedAccordionItems When true, the Payment Methods render as standalone buttons with space in between them. This property is only applicable to the accordion layout. - visibleAccordionItemsCount Sets the max number of Payment Methods visible before using the "More" button to hide additional Payment Methods. Set this value to 0 to disable the "More" button and render all available Payment Methods. Default is 5. This property is only applicable to the accordion layout. - paymentMethodLogoPosition Sets the position of the payment method logo in each accordion item. Default is start. This property is only applicable to the accordion layout. - defaultValues Provide initial customer information that will be displayed in the Payment Element. The form will render with empty fields if not provided. - billingDetails Specify customer's billing details, which lets you pre-fill a customer’s name, email, phone number and address if required by payment method. Pre-filling as much information as possible streamlines the checkout process. - name - email - phone - address - line1 - line2 - city The name of a city, town, village, etc. - state The most coarse subdivision of a country. Depending on the country, this might correspond to a state, a province, an oblast, a prefecture, or something else along these lines. - country Two-letter country code, capitalized. Valid two-letter country codes are specified by the related setting alpha-2. - postal_code The postal code or ZIP code, also known as PIN code in India. - paymentMethods Specify customer's default information for different payment methods. Pre-filling as much information as possible streamlines the checkout process. - ideal - bank A pre-filled iDEAL bank value for the Payment Element. Can only be one of the banks listed in the iDEAL guide (e.g., abn_amro). - payto - usePayId When true, the PayTo payment method will default to showing the PayID input instead of BSB/account number fields. Customers can still switch between PayID and BSB/account number using the toggle link. - card Specify default settings for card payments. - network Specifies a network preference for Card Brand Choice. The first network in the array that matches a network on the entered co-branded card will be selected by default in the Card Brand Choice dropdown. See the supported networks for valid values. - business Provide information about your business that will be displayed in the Payment Element. This information will be retrieved from your Stripe account if not provided. - name The name of your business. Your business name will be used to render mandate text for some payment methods. - paymentMethodOrder By default, the Payment Element will use a dynamic ordering that optimizes payment method display for each user. You can override the default order in which payment methods are displayed in the Payment Element with a list of payment method types. If the associated PaymentIntent has payment method types not specified in paymentMethodOrder, they will be displayed after the payment methods you specify. If you specify payment method types not on the associated PaymentIntent, they will be ignored. - fields By default, the Payment Element collects all necessary details to complete a payment. For some payment methods, the Payment Element collects details such as name or email that you might have already collected from the customer. If this is the case, you can prevent the Payment Element from collecting these details by using the fields option. If you disable collecting certain fields with the fields option, you must pass that same data to stripe.confirmPayment or we'll reject the payment. You can set billingDetails at the top level to apply the same field collection settings to all payment methods, or set billingDetails under a supported payment method type to override the top-level setting for that payment method. Learn how to customize the billing details to collect and the customized fields. - billingDetails Specify never to avoid collecting all billing details in the Payment Element. If you would like to disable only certain billing details, pass an object specifying which fields you would like to disable collection for. The default setting for each field or object is auto. - name Specify always to require the Payment Element to collect the customer's billing name. - email Specify never to avoid collecting email in the Payment Element. Note that this parameter is independent of walletOptions, so if you set fields.billingDetails.email=never and walletOptions.emailRequired=true, email is still collected from wallets. - phone Specify never to avoid collecting phone in the Payment Element. Note that this parameter is independent of walletOptions, so if you set fields.billingDetails.phone=never and walletOptions.phoneNumberRequired=true, phone is still collected from wallets. - address Specify if_required to only collect the minimum billing address fields required to complete the payment. You can omit and hide optional address fields in the card form, such as country and postal code. Unlike the never option, you don't need to include fields omitted in the Payment Element when confirming the payment. This can reduce the amount of information required to complete the form. Disabling address collection can negatively impact authorization rates and network fees for users on a network cost plus pricing plan. - line1 - line2 - city The name of a city, town, village, etc. - state The most coarse subdivision of a country. Depending on the country, this might correspond to a state, a province, an oblast, a prefecture, or something else along these lines. - country Two-letter country code, capitalized. Valid two-letter country codes are specified by the related setting alpha-2. - postalCode The postal code or ZIP code, also known as PIN code in India. - [paymentMethodType] Optionally specify the billing detail collection settings for any Payment Element payment method type. Examples of valid values are card, klarna, or us_bank_account. You can include one or more payment method type keys. - billingDetails Specify never to avoid collecting all billing details in the Payment Element. If you would like to disable only certain billing details, pass an object specifying which fields you would like to disable collection for. The default setting for each field or object is auto. - name Specify always to require the Payment Element to collect the customer's billing name. - email Specify never to avoid collecting email in the Payment Element. Note that this parameter is independent of walletOptions, so if you set fields.billingDetails.email=never and walletOptions.emailRequired=true, email is still collected from wallets. - phone Specify never to avoid collecting phone in the Payment Element. Note that this parameter is independent of walletOptions, so if you set fields.billingDetails.phone=never and walletOptions.phoneNumberRequired=true, phone is still collected from wallets. - address Specify if_required to only collect the minimum billing address fields required to complete the payment. You can omit and hide optional address fields in the card form, such as country and postal code. Unlike the never option, you don't need to include fields omitted in the Payment Element when confirming the payment. This can reduce the amount of information required to complete the form. Disabling address collection can negatively impact authorization rates and network fees for users on a network cost plus pricing plan. - line1 - line2 - city The name of a city, town, village, etc. - state The most coarse subdivision of a country. Depending on the country, this might correspond to a state, a province, an oblast, a prefecture, or something else along these lines. - country Two-letter country code, capitalized. Valid two-letter country codes are specified by the related setting alpha-2. - postalCode The postal code or ZIP code, also known as PIN code in India. - readOnly Applies a read-only state to the Payment Element so that payment details can’t be changed. Default is false. Enabling the readOnly option doesn't change the Payment Element's visual appearance. If you want to adjust the way the Payment Element looks, use the Appearance API. - terms Control how mandates or other legal agreements are displayed in the Payment Element. Use never to never display legal agreements. The default setting is auto, which causes legal agreements to only be shown when necessary. Consult your legal and compliance advisors before making any changes to the text of mandates or legal agreements. You can't use the terms option to violate obligations under your Stripe agreement, Stripe policies, applicable laws or scheme rules. - applePay - auBecsDebit - bancontact - card - cashapp - googlePay - ideal - paypal - sepaDebit - sofort - usBankAccount - walletOptions Options to control the information collected from the customer when paying with a wallet payment method. - emailRequired Collect the customer's email from wallet payment methods by setting this option to true. - phoneNumberRequired Collect the customer's phone number from wallet payment methods by setting this option to true. PayPal doesn't provide a phone number, even when this option is set to true. Google Pay makes a best effort to return the phone number registered to the wallet, but doesn't guarantee it will be provided in all cases. Link makes a best effort to return the phone number registered to the wallet, but doesn't guarantee it will be provided in all cases. - applePay Specify Apple Pay specific options. These are passed through to the Apple Pay API. - recurringPaymentRequest Specify a request to set up a recurring payment. See the Apple Pay documentation for more details. - paymentDescription - managementURL - regularBilling - amount - label - recurringPaymentStartDate - recurringPaymentEndDate - recurringPaymentIntervalUnit - recurringPaymentIntervalCount - trialBilling - amount - label - recurringPaymentStartDate - recurringPaymentEndDate - recurringPaymentIntervalUnit - recurringPaymentIntervalCount - billingAgreement - deferredPaymentRequest Specify a request to set up a deferred payment. See the Apple Pay documentation for more details. - paymentDescription - managementURL - deferredBilling - amount - amountType Indicates whether the billing amount is known at request time. When set to 'final', the Apple Pay payment sheet shows the configured amount. - label - deferredPaymentDate - billingAgreement - freeCancellationDate If set, you must also supply a freeCancellationDateTimeZone. - freeCancellationDateTimeZone If set, you must also supply a freeCancellationDate. These are tz timezones such as America/Los_Angeles, Europe/Dublin, and Asia/Singapore. - automaticReloadPaymentRequest Specify a request to set up an automatic reload payment. See the Apple Pay documentation for more details. - paymentDescription - managementURL - automaticReloadBilling - amount - label - automaticReloadPaymentThresholdAmount - billingAgreement ### Example title Update a Payment Element ## Fetch Server Updates elements.fetchUpdates() Used with the Payment Element. This method fetches updates from the associated PaymentIntent or SetupIntent on an existing instance of Elements, and reflects these updates in the Payment Element. ### Example title Fetch Server Updates ## Collapse a Payment Element element.collapse() This method collapses the Payment Element into a row of payment method tabs. ### Example title Collapse a Payment Element ## Available payment methods change event element.on(event: 'availablepaymentmethodschange', handler: function) Triggered when there is a change to which payment methods are available in the Payment Element. Also fires on initial render. - event The name of the event. In this case, availablepaymentmethodschange. - handler handler(event) => void is a callback function that you provide that will be called when the event is fired. When called it will be passed an event object with the following properties: - elementType The type of element the event is fired from. - paymentMethods Describes which payment methods are available in the Payment Element. Returns undefined when no payment methods are available. Payment methods are returned in alphabetical order. - `
An object for each camelCase payment method name that may be available based on your configuration. -available### Example ```title Handle an availablepaymentmethodschange event ``` ## The Express Checkout Element The Express Checkout Element is an embeddable component for accepting payments through one-click payment buttons. ## Create the Express Checkout Elementelements.create(type: 'expressCheckout', options?: object)This method creates an instance of the Express Checkout Element. -typeThe type of Element being created, which isexpressCheckoutin this case. -optionsOptions for creating the Express Checkout Element. -allowedShippingCountriesBy default, the Express Checkout Element allows all countries for shipping. You can specify which countries are allowed for shipping in the Express Checkout Element with a list of two-letter country codes. -applePaySpecify Apple Pay specific options. These are passed through to the Apple Pay API. -recurringPaymentRequestSpecify a request to set up a recurring payment. See the [Apple Pay documentation](https://developer.apple.com/documentation/applepayontheweb/applepayrecurringpaymentrequest) for more details. -paymentDescription-managementURL-regularBilling-amount-label-recurringPaymentStartDate-recurringPaymentEndDate-recurringPaymentIntervalUnit-recurringPaymentIntervalCount-trialBilling-amount-label-recurringPaymentStartDate-recurringPaymentEndDate-recurringPaymentIntervalUnit-recurringPaymentIntervalCount-billingAgreement-deferredPaymentRequestSpecify a request to set up a deferred payment. See the [Apple Pay documentation](https://developer.apple.com/documentation/applepayontheweb/applepaydeferredpaymentrequest) for more details. -paymentDescription-managementURL-deferredBilling-amount-amountTypeIndicates whether the billing amount is known at request time. When set to 'final', the Apple Pay payment sheet shows the configured amount. -label-deferredPaymentDate-billingAgreement-freeCancellationDateIf set, you must also supply a freeCancellationDateTimeZone. -freeCancellationDateTimeZoneIf set, you must also supply a freeCancellationDate. These are [tz](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) timezones such asAmerica/Los_Angeles, Europe/Dublin, and Asia/Singapore. - automaticReloadPaymentRequestSpecify a request to set up an automatic reload payment. See the [Apple Pay documentation](https://developer.apple.com/documentation/applepayontheweb/applepayautomaticreloadpaymentrequest) for more details. -paymentDescription-managementURL-automaticReloadBilling-amount-label-automaticReloadPaymentThresholdAmount-billingAgreement-billingAddressRequiredControls whether the Express Checkout Element collects the billing address. The default value depends on your integration: - If you passallowedShippingCountries, phoneNumberRequired, shippingAddressRequired, emailRequired, applePay, lineItems, or businesswhen creating the Express Checkout Element,billingAddressRequireddefaults to false. - Otherwise,billingAddressRequireddefaults to true. You can explicitly setbillingAddressRequiredto true or false to override the default behavior. We highly recommend that you collect the billing address because it can be used to perform address verifications and block fraudulent payments. -businessProvide information about your business that's displayed in the Express Checkout Element. This information will be retrieved from your Stripe account if it's not provided. -nameThe name of your business. Your business name is used to signal to the customer who they're paying. Klarna always retrieves the business name from your Stripe account, even when this option is set. -buttonHeightBy default, the height of the buttons are 44px. You can override this to specify a custom button height in the range of 40px-55px. -buttonThemeSpecify the preferred button theme to use. By default, Elements determines the themes based on the specified [appearance option](./create.md). -applePay-googlePay-paypal-klarna-buttonTypeSpecify the preferred button type to display. -applePayDefault isplain. - googlePayDefault isbuy. - paypalDefault ispaypal. - klarnaDefault ispay. - emailRequiredCollect the customer's email by setting this option totrue. - layoutSpecify how the buttons are arranged in a grid-like layout in the Express Checkout Element. Elements determines the layout by using certain factors, such as available space, number of buttons, and the definedlayoutobject. -maxColumnsDefines the maximum number of columns the Express Checkout Element can use to render. Default is0, meaning unlimited. - maxRowsDefines the maximum number of rows the Express Checkout Element can use to render. Default is0, meaning unlimited. - overflowSpecify whether or not to always hide the overflow menu or allow Elements to determine when to show the overflow menu. Default isauto. You can't specify both overflow: 'never'and setmaxRowsto a number greater than 0. -lineItemsAn array of LineItem objects. These LineItems are shown as line items in the payment interface, if line items are supported. You can represent discounts as negative amount LineItems. -nameThe name of the line item surfaced to the customer in the payment interface. -amountThe amount in the currency's subunit (for example, cents, yen, etc.). -paymentMethodsBy default, the Express Checkout Element displays all payment methods possible as a result of your Dashboard configuration. This is theautobehavior. If you don't want to show a given payment method as a payment option, set its property inpaymentMethodstonever. - amazonPay-applePayApple Pay has additional configurations that determine when Stripe can show it. By default, Apple Pay shows when the customer is using a supported platform and when we determine it's advantageous for your conversion. This is theautobehavior. If you want to always show Apple Pay when the customer is using a supported platform, you can set its property inpaymentMethodstoalways. This causes Apple Pay to be shown in supported browsers even when the customer isn't logged in to Apple Pay, resulting in a sign-in flow. Apple Pay on non-Safari desktop browsers is only supported when its property in paymentMethodsis set toalways. - googlePayGoogle Pay has additional configurations that determine when Stripe can show it. By default, Google Pay shows when the customer is using a supported platform and when we determine it's advantageous for your conversion. This is theautobehavior. If you want to always show Google Pay when the customer is using a supported platform, you can set its property inpaymentMethodstoalways. This causes Google Pay to be shown in supported browsers even when the customer isn't logged in to Google Pay, resulting in a sign-in flow. - link-paypal-klarna-paymentMethodOrderBy default, the Express Checkout Element uses a dynamic ordering that optimizes payment method display for each user. You can override the default order in which payment methods display in the Express Checkout Element with a list of payment method types. If there are payment methods that will show that are not specified inpaymentMethodOrder, they display after the payment methods you specify. If you specify payment methods that will not show, they are ignored. - phoneNumberRequiredCollect the customer's phone number by setting this option totrue. PayPal doesn't provide a phone number, even when this option is set to true. Google Pay makes a best effort to return the phone number registered to the wallet, but doesn't guarantee it will be provided in all cases. - shippingAddressRequiredCollect the customer's shipping address by setting this option totrue. If true, you must also supply a valid shippingRatesoption in either thecreate, click, or shippingaddresschangeevents. -shippingRatesAn array of ShippingRate objects. The first shipping rate listed appears in the payment interface as the default option. -idUnique identifier for the object. -amountThe amount to charge for shipping. -displayNameThe name of the shipping rate, displayed to the customer in the payment interface. -deliveryEstimateThe estimated range for how long shipping takes, displayed to the customer in the payment interface. We recommended using the object format, but you can use a string instead. -maximumThe upper bound of the estimated range. If empty, it represents no upper bound (for example, infinite). -unitA unit of time. -valueMust be greater than 0. -minimumThe lower bound of the estimated range. If empty, it represents no lower bound. -unitA unit of time. -valueMust be greater than 0. ### Example ```title Create an Express Checkout Element ``` ## Get an Express Checkout Elementelements.getElement(type: 'expressCheckout')This method retrieves a previously created Express Checkout Element. -typeThe type of Element being retrieved, which isexpressCheckoutin this case. ### Example ```title Get an Express Checkout Element ``` ## Update an Express Checkout Elementelement.update(options: object)Updates the options the [Express Checkout Element](./express-checkout-element.md) was initialized with. Updates merge into the existing configuration. -optionsOptions for updating the Express Checkout Element. -allowedShippingCountriesBy default, the Express Checkout Element allows all countries for shipping. You can specify which countries are allowed for shipping in the Express Checkout Element with a list of two-letter country codes. -billingAddressRequiredControls whether the Express Checkout Element collects the billing address. The default value depends on your integration: - If you passallowedShippingCountries, phoneNumberRequired, shippingAddressRequired, emailRequired, applePay, lineItems, or businesswhen creating the Express Checkout Element,billingAddressRequireddefaults to false. - Otherwise,billingAddressRequireddefaults to true. You can explicitly setbillingAddressRequiredto true or false to override the default behavior. We highly recommend that you collect the billing address because it can be used to perform address verifications and block fraudulent payments. -emailRequiredCollect the customer's email by setting this option totrue. - layoutSpecify how the buttons are arranged in a grid-like layout in the Express Checkout Element. Elements determines the layout by using certain factors, such as available space, number of buttons, and the definedlayoutobject. -maxColumnsDefines the maximum number of columns the Express Checkout Element can use to render. Default is0, meaning unlimited. - maxRowsDefines the maximum number of rows the Express Checkout Element can use to render. Default is0, meaning unlimited. - overflowSpecify whether or not to always hide the overflow menu or allow Elements to determine when to show the overflow menu. Default isauto. You can't specify both overflow: 'never'and setmaxRowsto a number greater than 0. -paymentMethodOrderBy default, the Express Checkout Element uses a dynamic ordering that optimizes payment method display for each user. You can override the default order in which payment methods display in the Express Checkout Element with a list of payment method types. If there are payment methods that will show that are not specified inpaymentMethodOrder, they display after the payment methods you specify. If you specify payment methods that will not show, they are ignored. - phoneNumberRequiredCollect the customer's phone number by setting this option totrue. PayPal doesn't provide a phone number, even when this option is set to true. Google Pay makes a best effort to return the phone number registered to the wallet, but doesn't guarantee it will be provided in all cases. - shippingAddressRequiredCollect the customer's shipping address by setting this option totrue. If true, you must also supply a valid shippingRatesoption in either thecreate, click, or shippingaddresschangeevents. ### Example ```title Update an Express Checkout Element ``` ## Click eventexpressCheckoutElement.on(event: 'click', handler: function)Theclickevent is triggered from an Express Checkout Element when the customer clicks a payment button. Use this event to configure the payment interface. -eventThe name of the event. In this case,click. - handler handler(event) => voidis a **callback function** you provide that's called after the event is fired. After it's called, it passes an event object with the following properties: -elementTypeThe type of element the event is fired from, which isexpressCheckoutin this case. -expressPaymentTypeThe payment method the customer checks out with. -resolveA functionresolve(payload) => voidthat's called to show the payment interface. You must call this function within 1 second if you handle theclickevent. -allowedShippingCountries (deprecated)_This parameter has been deprecated in favor of theallowedShippingCountriesparam on the [create](./create-express-checkout-element.md) function._ By default, the Express Checkout Element allows all countries for shipping. You can specify which countries are allowed for shipping in the Express Checkout Element with a list of two-letter country codes. -applePaySpecify Apple Pay specific options. These are passed through to the Apple Pay API. -recurringPaymentRequestSpecify a request to set up a recurring payment. See the [Apple Pay documentation](https://developer.apple.com/documentation/applepayontheweb/applepayrecurringpaymentrequest) for more details. -paymentDescription-managementURL-regularBilling-amount-label-recurringPaymentStartDate-recurringPaymentEndDate-recurringPaymentIntervalUnit-recurringPaymentIntervalCount-trialBilling-amount-label-recurringPaymentStartDate-recurringPaymentEndDate-recurringPaymentIntervalUnit-recurringPaymentIntervalCount-billingAgreement-deferredPaymentRequestSpecify a request to set up a deferred payment. See the [Apple Pay documentation](https://developer.apple.com/documentation/applepayontheweb/applepaydeferredpaymentrequest) for more details. -paymentDescription-managementURL-deferredBilling-amount-amountTypeIndicates whether the billing amount is known at request time. When set to 'final', the Apple Pay payment sheet shows the configured amount. -label-deferredPaymentDate-billingAgreement-freeCancellationDateIf set, you must also supply a freeCancellationDateTimeZone. -freeCancellationDateTimeZoneIf set, you must also supply a freeCancellationDate. These are [tz](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) timezones such asAmerica/Los_Angeles, Europe/Dublin, and Asia/Singapore. - automaticReloadPaymentRequestSpecify a request to set up an automatic reload payment. See the [Apple Pay documentation](https://developer.apple.com/documentation/applepayontheweb/applepayautomaticreloadpaymentrequest) for more details. -paymentDescription-managementURL-automaticReloadBilling-amount-label-automaticReloadPaymentThresholdAmount-billingAgreement-billingAddressRequired (deprecated)_This parameter has been deprecated in favor of thebillingAddressRequiredparam on the [create](./create-express-checkout-element.md) function._ By default, the Express Checkout Element collects the billing address. You can disable this by settingbillingAddressRequiredtofalse. We highly recommend that you collect the billing address because it can be used to perform address verifications and block fraudulent payments. - business (deprecated)_This parameter has been deprecated in favor of thebusinessparam on the [create](./create-express-checkout-element.md) function._ Provide information about your business that's displayed in the Express Checkout Element. This information will be retrieved from your Stripe account if it's not provided. -nameThe name of your business. Your business name is used to signal to the customer who they're paying. Klarna always retrieves the business name from your Stripe account, even when this option is set. -emailRequired (deprecated)_This parameter has been deprecated in favor of theemailRequiredparam on the [create](./create-express-checkout-element.md) function._ Collect the customer's email by setting this option totrue. - lineItemsAn array of LineItem objects. These LineItems are shown as line items in the payment interface, if line items are supported. You can represent discounts as negative amount LineItems. -nameThe name of the line item surfaced to the customer in the payment interface. -amountThe amount in the currency's subunit (for example, cents, yen, etc.). -phoneNumberRequired (deprecated)_This parameter has been deprecated in favor of thephoneNumberRequiredparam on the [create](./create-express-checkout-element.md) function._ Collect the customer's phone number by setting this option totrue. PayPal doesn't provide a phone number, even when this option is set to true. - shippingAddressRequired (deprecated)_This parameter has been deprecated in favor of theshippingAddressRequiredparam on the [create](./create-express-checkout-element.md) function._ Collect the customer's shipping address by setting this option totrue. If true, you must also supply a valid shippingRatesoption in either thecreate, click, or shippingaddresschangeevents. -shippingRatesAn array of ShippingRate objects. The first shipping rate listed appears in the payment interface as the default option. -idUnique identifier for the object. -amountThe amount to charge for shipping. -displayNameThe name of the shipping rate, displayed to the customer in the payment interface. -deliveryEstimateThe estimated range for how long shipping takes, displayed to the customer in the payment interface. We recommended using the object format, but you can use a string instead. -maximumThe upper bound of the estimated range. If empty, it represents no upper bound (for example, infinite). -unitA unit of time. -valueMust be greater than 0. -minimumThe lower bound of the estimated range. If empty, it represents no lower bound. -unitA unit of time. -valueMust be greater than 0. -rejectA functionreject() => voidthat's called to cancel the payment interface. You must call this function within 1 second if you handle theclickevent. ### Example ```title Handle an express checkout element click event ``` ## Confirm eventexpressCheckoutElement.on(event: string, handler: function)Theconfirmevent is triggered from an Express Checkout Element when the customer finalizes their payment. Use this event to trigger payment confirmation. -eventThe name of the event. In this case,confirm. - handlerA callback functionhandler(event) => voidyou provide that's called after the event is fired. When called, it passes an event object with the following properties: -elementTypeThe type of element the event fires from, which isexpressCheckoutin this case. -expressPaymentTypeThe payment method the customer checks out with. -paymentFailedA functionpaymentFailed(payload) => voidthat's called if you're unable to process the customer's payment. -reasonDefault is'fail'. The payment interface might surface the reason to provide a hint to the customer on why their payment failed. - messageA short, concise, localized error message to display on the payment sheet. If none is provided, the payment sheet will display a generic error message for the given reason. **Wallet compatibility:** Apple Pay displays custom error messages for'invalid_shipping_address', 'invalid_billing_address', and 'invalid_payment_data', but not for 'fail'or'address_unserviceable'. Other wallets may not support custom messages or may truncate them. - billingDetailsObject containing information about the customer's billing details. -nameThe name of the customer. -emailThe email address of the customer. -phoneThe phone number of the customer. -addressThe billing address of the customer. -line1-line2-city-state-postal_code-country-shippingAddressObject containing information about the customer's shipping address. -nameThe name of the recipient. -addressThe shipping address of the customer. -line1-line2-city-state-postal_code-country-shippingRateObject containing information about the selected shipping rate. -idUnique identifier for the object. -amountThe amount to charge for shipping. -displayNameThe name of the shipping rate, displayed to the customer in the payment interface. -deliveryEstimateThe estimated range for how long shipping takes, displayed to the customer in the payment interface. We recommended using the object format, but you can use a string instead. -maximumThe upper bound of the estimated range. If empty, it represents no upper bound (for example, infinite). -unitA unit of time. -valueMust be greater than 0. -minimumThe lower bound of the estimated range. If empty, it represents no lower bound. -unitA unit of time. -valueMust be greater than 0. ### Example ```title Handle 'confirm' event ``` ## Cancel eventexpressCheckoutElement.on(event: string, handler: function)Thecancelevent is triggered from an Express Checkout Element when the payment interface is dismissed. Note that in some browsers, the payment interface might be dismissed by the customer even after they authorize the payment. This means that you might receive acancelevent after receiving aconfirmevent. If you're using thecancelevent as a hook for canceling the customer's order, make sure you also refund the payment that you just created. -eventThe name of the event. In this case,cancel. - handlerA callback function that you provide that's called after the event is fired. ### Example ```title Handle 'cancel' event ``` ## Available payment methods change eventexpressCheckoutElement.on(event: 'availablepaymentmethodschange', handler: function)Triggered when there is a change to which buttons are available in the Express Checkout Element. Also fires on initial render. -eventThe name of the event. In this case,availablepaymentmethodschange. - handler handler(event) => voidis a **callback function** that you provide that will be called when the event is fired. When called it will be passed an event object with the following properties: -elementTypeThe type of element the event is fired from. -paymentMethodsDescribes which buttons render in the Element. Returnsundefinedif no buttons will render. Payment methods are returned in alphabetical order. Each value is an object with anavailableboolean field. If you configured [custom payment methods](https://docs.stripe.com/payments/payment-element/custom-payment-methods.md) with anexpressCheckoutobject, their IDs (prefixed withcpmt_) also appear as keys in this object. - amazonPay-available-applePay-available-googlePay-available-klarna-available-link-available-paypal-available### Example ```title Handle an availablepaymentmethodschange event ``` ## Shippingaddresschange eventexpressCheckoutElement.on(event: string, handler: function)Theshippingaddresschangeevent is triggered from an Express Checkout Element whenever the customer selects a new address in the payment interface. This event is not available for Elements with Checkout Sessions (EwCS integrations). When using an Express Checkout Element with a Checkout Session, shipping address changes are managed through the Checkout Session itself. You can update the session on your server after the customer completes their payment rather than responding to this event during the payment flow. -eventThe name of the event. In this case,shippingaddresschange. - handlerA callback functionhandler(event) => voidyou provide that's called after the event is fired. After it's called, it passes an event object with the following properties: -elementTypeThe type of element the event is fired from, which isexpressCheckoutin this case. -resolveA functionresolve(payload) => voidthat's called if the recipient's shipping address is valid. -applePaySpecify Apple Pay specific options. These are passed through to the Apple Pay API. -recurringPaymentRequestSpecify a request to set up a recurring payment. See the [Apple Pay documentation](https://developer.apple.com/documentation/applepayontheweb/applepayrecurringpaymentrequest) for more details. -paymentDescription-managementURL-regularBilling-amount-label-recurringPaymentStartDate-recurringPaymentEndDate-recurringPaymentIntervalUnit-recurringPaymentIntervalCount-trialBilling-amount-label-recurringPaymentStartDate-recurringPaymentEndDate-recurringPaymentIntervalUnit-recurringPaymentIntervalCount-automaticReloadPaymentRequestSpecify a request to set up an automatic reload payment. See the [Apple Pay documentation](https://developer.apple.com/documentation/applepayontheweb/applepayautomaticreloadpaymentrequest) for more details. -paymentDescription-managementURL-automaticReloadBilling-amount-label-automaticReloadPaymentThresholdAmount-lineItemsAn array of LineItem objects. These LineItems are shown as line items in the payment interface, if line items are supported. -nameThe name of the line item surfaced to the customer in the payment interface. -amountThe amount in the currency's subunit (for example, cents, yen, etc.). -shippingRatesAn array of ShippingRate objects. The first shipping rate listed appears in the payment interface as the default option. -idUnique identifier for the object. -amountThe amount to charge for shipping. -displayNameThe name of the shipping rate, displayed to the customer in the payment interface. -deliveryEstimateThe estimated range for how long shipping takes, displayed to the customer in the payment interface. We recommended using the object format, but you can use a string instead. -maximumThe upper bound of the estimated range. If empty, it represents no upper bound (for example, infinite). -unitA unit of time. -valueMust be greater than 0. -minimumThe lower bound of the estimated range. If empty, it represents no lower bound. -unitA unit of time. -valueMust be greater than 0. -rejectA functionreject() => voidthat's called if the recipient's shipping address is invalid. -nameThe name of the recipient. -addressThe shipping address of the recipient. To maintain privacy, browsers might anonymize the shipping address by removing sensitive information that isn't necessary to calculate shipping costs. Depending on the country, some fields can be missing or partially redacted. For example, the shipping address in the US can only contain a city, state, and ZIP code. The full shipping address appears in the [confirm event](./express-checkout-element-confirm-event.md) object after the purchase is confirmed in the browser’s payment interface. -city-state-postal_code-country### Example ```title Handle 'shippingaddresschange' event ``` ## Shippingratechange eventexpressCheckoutElement.on(event: string, handler: function)Theshippingratechangeevent is triggered from an Express Checkout Element whenever the customer selects a new shipping rate in the payment interface. This event is not available for Elements with Checkout Sessions (EwCS integrations). When using an Express Checkout Element with a Checkout Session, shipping rate changes are managed through the Checkout Session itself. You can update the session on your server after the customer completes their payment rather than responding to this event during the payment flow. -eventThe name of the event. In this case,shippingratechange. - handlerA callback functionhandler(event) => voidyou provide that's called after the event is fired. After it's called, it passes an event object with the following properties: -elementTypeThe type of element the event is fired from, which isexpressCheckoutin this case. -resolveA functionresolve(payload) => voidthat's called if the customer's shipping rate is valid. -applePaySpecify Apple Pay specific options. These are passed through to the Apple Pay API. -recurringPaymentRequestSpecify a request to set up a recurring payment. See the [Apple Pay documentation](https://developer.apple.com/documentation/applepayontheweb/applepayrecurringpaymentrequest) for more details. -paymentDescription-managementURL-regularBilling-amount-label-recurringPaymentStartDate-recurringPaymentEndDate-recurringPaymentIntervalUnit-recurringPaymentIntervalCount-trialBilling-amount-label-recurringPaymentStartDate-recurringPaymentEndDate-recurringPaymentIntervalUnit-recurringPaymentIntervalCount-automaticReloadPaymentRequestSpecify a request to set up an automatic reload payment. See the [Apple Pay documentation](https://developer.apple.com/documentation/applepayontheweb/applepayautomaticreloadpaymentrequest) for more details. -paymentDescription-managementURL-automaticReloadBilling-amount-label-automaticReloadPaymentThresholdAmount-lineItemsAn array of LineItem objects. These LineItems are shown as line items in the payment interface, if line items are supported. -nameThe name of the line item surfaced to the customer in the payment interface. -amountThe amount in the currency's subunit (for example, cents, yen, etc.). -shippingRatesAn array of ShippingRate objects. The first shipping rate listed appears in the payment interface as the default option. -idUnique identifier for the object. -amountThe amount to charge for shipping. -displayNameThe name of the shipping rate, displayed to the customer in the payment interface. -deliveryEstimateThe estimated range for how long shipping takes, displayed to the customer in the payment interface. We recommended using the object format, but you can use a string instead. -maximumThe upper bound of the estimated range. If empty, it represents no upper bound (for example, infinite). -unitA unit of time. -valueMust be greater than 0. -minimumThe lower bound of the estimated range. If empty, it represents no lower bound. -unitA unit of time. -valueMust be greater than 0. -rejectA functionreject() => voidthat's called if the customer's shipping rate is invalid. -shippingRateThe shipping rate selected by the customer. -idUnique identifier for the object. -amountThe amount to charge for shipping. -displayNameThe name of the shipping rate, displayed to the customer in the payment interface. -deliveryEstimateThe estimated range for how long shipping takes, displayed to the customer in the payment interface. We recommended using the object format, but you can use a string instead. -maximumThe upper bound of the estimated range. If empty, it represents no upper bound (for example, infinite). -unitA unit of time. -valueMust be greater than 0. -minimumThe lower bound of the estimated range. If empty, it represents no lower bound. -unitA unit of time. -valueMust be greater than 0. ### Example ```title Handle 'shippingratechange' event ``` ## The Contact Details Element The [Contact Details Element](https://docs.stripe.com/payments/link/accept-a-payment.md) is an embeddable component for collecting email addresses and allow users to log into Link on your checkout page. This element was previously known as the Link Authentication Element. ## Create the Contact Details Elementelements.create(type: 'contactDetails', options?: object)This method creates an instance of the Contact Details Element. -typeThe type of Element being created, which iscontactDetailsin this case. -optionsOptions for creating the Contact Details Element. -defaultValuesProvide the initial contact information that will be displayed in the Contact Details Element. The form will render with empty fields if not provided. -email### Example ```title Create a Contact Details Element ``` ## Get a Contact Details Elementelements.getElement(type: 'contactDetails')This method retrieves a previously created Contact Details Element. -typeThe type of Element being retrieved, which iscontactDetailsin this case. ### Example ```title Get a Contact Details Element ``` ## The Address Element The Address Element is an embeddable component for collecting local and international billing and shipping addresses. ## Create the Address Elementelements.create(type: 'address', options: object)This method creates an instance of the Address Element. **NOTE**: If you are creating multiple instances of the Address Element, configuration of the checkbox to sync shipping and billing addresses exists in the creation of the [Elements](./create.md) instance. -typeThe type of Element being created, which isaddressin this case. You can create multiple Address Elements, one of each mode, in a single Elements instance. -optionsOptions for creating the Address Element. -modeSpecify which mode you would like to use Address Element for. Whenshippingmode is used with the Payment Element and Contact Details Element, it will automatically pass shipping information when confirming Payment Intent or Setup Intent. Whenbillingmode is used with the Payment Element, it will automatically pass the billing information when confirming Payment Intent or Setup Intent. -autocompleteBy default, the Address Element will have autocomplete enabled with Stripe provided Google Maps API key for certain countries if any of the following condition is met: * If Payment Element is mounted in the same elements group as Address Element in a single page application. * If the Address Element is used in an active Link session (Link is also known as Onelink in the UK). [Contact Legal before editing or deleting the Google Maps autocomplete callout]: # By using autocomplete, you agree to comply with the [Google Maps Platform Acceptable Use Policy](https://cloud.google.com/maps-platform/terms/aup). If you violate this policy, we might disable autocomplete, or take any other action as necessary. You can customize the autocomplete setting with this option. -modeSpecifydisabledto disable autocomplete in the Address Element. Specifygoogle_maps_apito enable [Google Maps API](https://developers.google.com/maps/documentation/javascript/places) with your own key. It will only be used when Stripe provided Google Maps API key is not available. The default setting isautomatic, where we’ll support autocomplete when possible. - apiKeySpecify your own [Google Maps API key](https://developers.google.com/maps/documentation/javascript/places#add-places-api-to-the-api-keys-api-restrictions-list) with it. **Only needs to be passed in whenautocomplete.modeis set togoogle_maps_api.** - allowedCountriesBy default, the Address Element will display all countries for selection. You can specify which countries are displayed in the Address Element with a list of two-letter country codes. If only one country is specified, the country field will not display. -blockPoBoxBy default, PO boxes are considered a valid address type. You can override this to invalidate PO Boxes. -contactsAn array of objects that can be displayed as saved addresses in the Address Element. The first contact will be automatically selected. If using a [CustomerSession](https://docs.stripe.com/api/customer_sessions.md), Address Element will ignore contacts and render saved billing addresses instead. -nameThe name of the contact. This might be a person, or a business name. -addressThe address of the contact. -line1-line2-cityThe name of a city, town, village, etc. -stateThe most coarse subdivision of a country. Depending on the country, this might correspond to a state, a province, an oblast, a prefecture, or something else along these lines. -postal_codeThe postal code or ZIP code, also known as PIN code in India. -countryTwo-letter country code, capitalized. Valid two-letter country codes are specified by the related setting alpha-2. -phoneThe phone number of the contact. The [fields.phone](./create-address-element.md) option must be set toalwaysif this property is specified. -defaultValuesProvide the initial information that will be displayed in the Address Element. The form will render with empty fields if not provided. -nameProvide the initial full name or organization name. -firstNameProvide the initial first name. The [display.name](./create-address-element.md) option must be set tosplitif this property is specified. -lastNameProvide the initial last name. The [display.name](./create-address-element.md) option must be set tosplitif this property is specified. -phoneProvide the initial phone number value. The [fields.phone](./create-address-element.md) option must be set toalwaysif this property is specified. -addressProvide the initial address details. -line1-line2-city-state-postal_code-country-fieldsBy default, the Address Element will collect all the necessary information needed for an address. In some cases, it might be necessary to collect other types of information. You can specify other types of fields to render in the form with this option. -phoneSpecifyalwaysto enable phone number collection in the Address Element. Only collect phone numbers if you need them for the transaction. Default isauto. - validationBy default, the Address Element will enforce preset validation for each field. You can customize the settings by using this option. -phone-requiredSpecifyalwaysto make phone number a required field. The [fields.phone](./create-address-element.md) option must be set toalwaysif this property is specified. Default isauto. - displayYou can customize how certain fields are displayed. -nameBy default, the Address Element will display a full name field. Specify 'split' to display a first name field and a last name field. Specify 'organization' to display an organization field. ### Example ```title Create an Address Element ``` ## Get an Address Elementelements.getElement(type: 'address', options?: object)This method retrieves a previously created Address Element. -typeThe type of Element being retrieved, which isaddressin this case. -optionsOptions for retrieving the Address Element. -modeRequired when using multiple Address Elements. Specify which mode of the Address Element you would like to retrieve. ### Example ```title Get an Address Element ``` ## Update an Address Elementelement.update(options: object)Updates the options the [Address Element](./address-element.md) was initialized with. Updates are merged into the existing configuration. -optionsOptions for updating the Address Element. -fieldsBy default, the Address Element will collect all the necessary information needed for an address. In some cases, it might be necessary to collect other types of information. You can specify other types of fields to render in the form with this option. -phoneSpecifyalwaysto enable phone number collection in the Address Element. Only collect phone numbers if you need them for the transaction. Default isauto. - validationBy default, the Address Element will enforce preset validation for each field. You can customize the settings by using this option. -phone-requiredSpecifyalwaysto make phone number a required field. The [fields.phone](./create-address-element.md) option must be set toalwaysif this property is specified. Default isauto. ### Example ```title Update an Address Element ``` ## Get value from an Address Element element.getValue(options?: object)Validates and retrieves form values from an Address Element. If there are any input validation errors, the errors will display by their respective fields. -optionsAn optional options object to control the format of the returned values. -formatControls the format of thestatefield in the returned address value. *latin: Return the state in Latin characters (for example, "Tokyo"). * localized: Return the state in the locale's native script (for example, "東京"). If unspecified in Stripe.js Clover and below, format is determined by a heuristic based on the customer's browser language. If unspecified in Stripe.js Dahlia and above, defaults to latin. ### Example ```title Get value from an Address Element ``` ## The Tax ID Element The [Tax ID Element](https://docs.stripe.com/elements/tax-id-element.md) is an embeddable component for collecting customer tax ID information for tax reporting and compliance purposes. ## Create a Tax ID Element elements.create(type: 'taxId', options?: object)This method creates an instance of the Tax ID Element. > This feature requires theelements_tax_id_1beta. To use it, passbetas: ['elements_tax_id_1']when initializing Stripe.js. -typeThe type of Element being created, which istaxIdin this case. -optionsTax ID Element initialization options. -visibilityBy default, the Tax ID Element displays when the user is in a country that supports tax ID collection. Specifyalwaysto display the element regardless of the user's country. Specifyneverto hide the element completely. -fieldsBy default, the Tax ID Element collects all tax ID information. If it's not necessary for you to collect all fields, you can disable Tax ID Element collection of certain fields with thefieldsoption. -businessNameSpecifyalwaysto collect the business name. Specifyneverto not collect the business name. Default isauto. - validationBy default, the Tax ID Element will enforce preset validation for each field. You can customize the settings by using this option. -businessName-requiredSpecifyalwaysto make business name a required field. Specifyneverto make business name an optional field. Default isauto. - taxId-requiredSpecifyalwaysto make tax ID a required field. Specifyneverto make tax ID an optional field. Default isauto. - verificationConfigure real-time tax ID verification. Requires theelements_tax_id_verification_1beta. To use it, passbetas: ['elements_tax_id_1', 'elements_tax_id_verification_1']when initializing Stripe.js -taxId-modeSpecifyif_supportedto enable real-time tax ID verification for supported tax ID types. Specifyneverto disable verification. Default isnever. ### Example ```title Create a Tax ID Element ``` ## Retrieve a Tax ID Element elements.getElement(type: 'taxId')This method retrieves a previously created Tax ID Element. -typeThe type of Element being retrieved, which istaxIdin this case. ### Example ```title Retrieve a Tax ID Element ``` ## Get value from a Tax ID Elementelement.getValue()Validates and retrieves form values from a Tax ID Element. If there are any input validation errors, the errors are displayed by their associated fields. ### Example ```title Get value from a Tax ID Element ``` ## Issuing Elements [Issuing Elements](https://docs.stripe.com/issuing/elements.md) allows you to display the sensitive data of your Issuing cards in a PCI-compliant manner. ## Create an Elementelements.create(type: string, options: object)This method creates an instance of an individual Issuing Element. It takes thetypeof Element to create as well as anoptionsobject. ## Other Elements Stripe also offers a [set of Elements for individual payment methods](https://docs.stripe.com/payments/elements.md) that you can use in your payment flows. ## Create an Elementelements.create(type: string, options?: object)This method creates an instance of an individualElement. It takes the typeofElementto create as well as anoptionsobject. ## Get an Elementelements.getElement(type: string)This method looks up a previously created [Element](./element.md) by its type. -typeThe type of [Element](./create-element.md) to lookup. ### Example ```title Get an Element ``` ## Update an Elementelement.update(options: object)Updates the options the [Element](./element.md) was initialized with. Updates are merged into the existing configuration. If you collect certain information in a different part of your interface (e.g., ZIP or postal code), useelement.updatewith the appropriate information. The styles of anElementcan be dynamically changed usingelement.update. This method can be used to simulate CSS media queries that automatically adjust the size of elements when viewed on different devices. ## Style the Element container Style the container you mount an [Element](./element.md) to as if it were an
on your page. For example, to controlpaddingandborderon anElement, set these properties on the container. This is usually done by re-using the classes that you have applied to your DOM
elements. After theElementis mounted, the.StripeElementclass is added to the container. Additionally, the following classes are automatically added to the container when theElementis complete, empty, focused, invalid, or autofilled by the browser: *.StripeElement--complete*.StripeElement--empty*.StripeElement--focus*.StripeElement--invalid*.StripeElement--webkit-autofill(Chrome and Safari only) These class names can be customized using theclasses[option](./create-element.md) when you [create an Element](#elements_create). ## Input validation Stripe elements validate customer input as it is typed. To help your customers catch mistakes, listen tochangeevents on anElementand display any errors. ## Postal code formatting Thecardelement automatically determines your customer’s billing address country based on their card number. Using this information, the postal code field validation reflects whether that country uses numeric or alphanumeric-formatted postal codes, or if the country uses postal codes at all. For instance, if a U.S. card is entered, the postal code field only accepts a five-digit numeric value. If it’s a UK card, an alphanumeric value can be provided instead. Many of our test cards have a U.S. billing address country. When using these to test your payment form, you must also use a five-digit U.S. ZIP code (e.g., 12345). To test elements with other postal code formats, use our [international test card numbers](https://docs.stripe.com/testing.md#international-cards). ## Mount an Elementelement.mount(domElement: string | DOM element)Theelement.mountmethod attaches your [Element](./element.md) to the DOM.element.mountaccepts either a CSS Selector (e.g.,'#payment-element') or a DOM element. You need to create a container DOM element to mount an Element. Add an empty placeholder divto your payment form for each Element that you'll mount. Stripe inserts an iframe into eachdivto securely collect payment information. -domElementThe CSS selector or DOM element where your [Element](./element.md) will be mounted. ### Example ```title Mount an Element ``` ## Element methods Below are a number of methods that are in common between all [Element](./element.md) UIs. Wait until the [ready event](./on-ready.md) is triggered before calling these methods. ## Blur an Elementelement.blur()Blurs the [Element](./element.md). ### Example ```title Blur an Element ``` ## Clear an Element's valueselement.clear()Clears the value(s) of the [Element](./element.md). ### Example ```title Clear an Element ``` ## Destroy an Elementelement.destroy()Removes the [Element](./element.md) from the DOM and destroys it. A destroyedElementcan not be re-activated or re-mounted to the DOM. ### Example ```title Destroy an Element ``` ## Focus an Elementelement.focus()Focuses the [Element](./element.md). > This method will currently not work on iOS 13+ due to a system limitation. ### Example ```title Focus an Element ``` ## Unmount an Elementelement.unmount() Unmounts the [Element](./element.md) from the DOM. Call [element.mount](./mount.md) to re-attach it to the DOM. ### Example ```title Unmount an Element ``` ## Element events Communicate with your [Element](./element.md) by listening to an event. An Element might emit any of the events below. All events have a payload object that has an elementTypeproperty with the type of theElementthat emitted the event. ## Change eventelement.on(event: 'change', handler: function)The change event is triggered when any value in the change event payload changes. The event payload always contains certain keys, in addition to someElement-specific keys. > Consult with your legal counsel regarding your requirements and obligations about how you collect, use, and store customers' personal data ## Ready event element.on(event: 'ready', handler: function)Triggered when theElementis fully rendered and methods on the instance, likeelement.focus()andelement.update(), can be called. - eventThe name of the event. In this case,ready. - handler handler(event) => voidis a **callback function** that you provide that will be called when the event is fired. After it's called, it passes an event object with the following properties: -elementTypeThe type of element the event is fired from. -availablePaymentMethods (deprecated)_This field has been deprecated in favor of thepaymentMethods field on the [availablepaymentmethodschange](./express-checkout-element-availablepaymentmethodschange-event.md) event, which also fires when available payment methods change after load._ This field is **only** present on the expressCheckoutElement. Describes which buttons render in the Element. Returns undefined if no buttons will render. -link-applePay-googlePay-paypal-amazonPay-klarna### Example ```title Handle an Element ready event ``` ## Focus eventelement.on(event: 'focus', handler: function)Triggered when theElementgains focus. -eventThe name of the event. In this case,focus. - handler handler(event) => voidis a **callback function** that you provide that will be called when the event is fired. ### Example ```title Handle an Element focus event ``` ## Blur eventelement.on(event: 'blur', handler: function)Triggered when theElementloses focus. -eventThe name of the event. In this case,blur. - handler handler(event) => voidis a **callback function** that you provide that will be called when the event is fired. ### Example ```title Handle an Element blur event ``` ## Escape eventelement.on(event: 'escape', handler: function)Triggered when the escape key is pressed within an Element. -eventThe name of the event. In this case,escape. - handler handler(event) => voidis a **callback function** that you provide that will be called when the event is fired. ### Example ```title Handle an Element escape event ``` ## Click eventelement.on(event: 'click', handler: function)## LoadError eventelement.on(event: 'loaderror', handler: function)Triggered when theElementfails to load. **This event is only emitted from thepayment, linkAuthentication, address, expressCheckout, currencySelector, taxId, card, and cardNumberElements.** -eventThe name of the event. In this case,loaderror. - handler handler(event) => voidis a **callback function** that you provide that will be called when the event is fired. When called it will be passed an event object with the following properties: -elementTypeThe type of element that emitted this event. -errorAnerrorobject that describes the failure. ### Example ```title Handle an Element loaderror event ``` ## LoadStart eventelement.on(event: 'loaderstart', handler: function)Triggered when the [loader](./create.md) UI is mounted to the DOM and ready to be displayed. **This event is only emitted from thepayment, paymentForm, linkAuthentication, and addressElements.** -eventThe name of the event. In this case,loaderstart. - handler handler(event) => voidis a **callback function** that you provide that will be called when the event is fired. When called it will be passed an event object with the following properties: -elementTypeThe type of element that emitted this event. ### Example ```title Handle an Element loaderstart event ``` ## NetworksChange eventelement.on(event: 'networkschange', handler: function)Triggered when there is a change to the available networks the provided card can run on. If the list of available networks is still loading, an event withnetworks: nullandloading: trueis triggered. When the list of available networks loads, Stripe triggers an additional event that contains the list of these networks and showsloading: false`. Refer to our card brand choice guide for further details.
