Skip to content

<stripe-link-authentication-element>

This page is auto-generated from src/components/stripe-link-authentication-element/readme.md.

Get Stripe.js, and initialize elements

const stripeElement = document.createElement('stripe-link-authentication-element');
customElements
.whenDefined('stripe-link-authentication-element')
.then(() => {
stripeElement.initStripe('pk_test_XXXXXXXXX')
})

Update the progress status

const stripeElement = document.createElement('stripe-link-authentication-element');
customElements
.whenDefined('stripe-link-authentication-element')
.then(() => {
stripeElement.updateProgress('success')
})

Set error message

const stripeElement = document.createElement('stripe-link-authentication-element');
customElements
.whenDefined('stripe-link-authentication-element')
.then(() => {
stripeElement.setErrorMessage('Invalid email address')
})

Get the current email value from the element

const stripeElement = document.createElement('stripe-link-authentication-element');
customElements
.whenDefined('stripe-link-authentication-element')
.then(async () => {
const email = await stripeElement.getEmail();
console.log(email);
})

Stripe Client loaded event

const stripeElement = document.createElement('stripe-link-authentication-element');
customElements
.whenDefined('stripe-link-authentication-element')
.then(() => {
stripeElement
.addEventListener('stripeLoaded', async ({ detail: {stripe} }) => {
console.log('Stripe loaded:', stripe);
});
})

Link Authentication Element change event

const stripeElement = document.createElement('stripe-link-authentication-element');
customElements
.whenDefined('stripe-link-authentication-element')
.then(() => {
stripeElement
.addEventListener('linkAuthenticationChange', async ({ detail }) => {
console.log('Email changed:', detail.email);
})
})
Property Attribute Description Type Default
applicationName application-name Overwrite the application name that registered For wrapper library (like Capacitor) string 'stripe-pwa-elements'
defaultEmail default-email Default email value to prefill the element string undefined
handleChange – Link Authentication Element change handler (event: LinkAuthenticationElementChangeEvent) => void | Promise<void> undefined
publishableKey publishable-key Your Stripe publishable API key. string undefined
stripeAccount stripe-account Optional. Making API calls for connected accounts string undefined
stripeDidLoaded – Stripe.js class loaded handler (event: StripeLoadedEvent) => Promise<void> undefined
Event Description Type
linkAuthenticationChange Link Authentication Element change event Emitted when the email value changes CustomEvent<{ stripe: Stripe; linkAuthenticationElement: StripeLinkAuthenticationElement; email?: string; }>
stripeLoaded Stripe Client loaded event CustomEvent<{ stripe: Stripe; }>

Get the current email value from the element

Type: Promise<string>

The current email value or undefined

initStripe(publishableKey: string, options?: InitStripeOptions) => Promise<void>

Section titled “initStripe(publishableKey: string, options?: InitStripeOptions) => Promise<void>”

Get Stripe.js, and initialize elements

Name Type Description
publishableKey string
options { stripeAccount?: string; }

Type: Promise<void>

setErrorMessage(errorMessage: string) => Promise<this>

Section titled “setErrorMessage(errorMessage: string) => Promise<this>”

Set error message

Name Type Description
errorMessage string string

Type: Promise<this>

updateProgress(progress: ProgressStatus) => Promise<this>

Section titled “updateProgress(progress: ProgressStatus) => Promise<this>”

Update the progress status

Name Type Description
progress "" | "loading" | "success" | "failure"

Type: Promise<this>


Built with StencilJS