Core Concepts

Link Authentication Element

Collect email addresses and allow users to log in to Link

The Link Authentication Element collects email addresses and allows users to log in to Link, Stripe's one-click checkout solution. When customers authenticate with Link, they can use saved payment methods and shipping addresses for faster checkout.

The Link Authentication Element is typically placed before the Payment Element to enable Link checkout for returning customers.

Basic Usage

<script setup>
import { loadStripe } from '@stripe/stripe-js'
import { Elements, LinkAuthenticationElement } from 'vue-stripe'

const stripePromise = loadStripe('pk_test_xxx')
</script>

<template>
  <Elements :stripe="stripePromise">
    <form>
      <LinkAuthenticationElement />
      <PaymentElement />
      <button type="submit">
        Pay
      </button>
    </form>
  </Elements>
</template>

With Options

<template>
  <LinkAuthenticationElement
    :options="{
      defaultValues: {
        email: 'customer@example.com',
      },
    }"
  />
</template>

Props

PropTypeDescription
optionsLinkAuthenticationElementOptionsConfiguration options for the Link Authentication Element. See available options.

Events

EventDescription
@readyTriggered when the Link Authentication Element is fully rendered
@changeTriggered when the email address changes or when authentication status changes
@focusTriggered when the Element receives focus
@blurTriggered when the Element loses focus
@loaderstartTriggered when the loader UI is mounted
@loadererrorTriggered when the Element fails to load

Example with Change Handler

<script setup>
import { ref } from 'vue'
import { LinkAuthenticationElement } from 'vue-stripe'

const email = ref(null)

function handleChange(event) {
  if (event.valueType === 'email') {
    email.value = event.value
  }

  if (event.complete) {
    // Email is valid and user is authenticated with Link
    console.log('Link authenticated:', email.value)
  }
}
</script>

<template>
  <form>
    <LinkAuthenticationElement @change="handleChange" />
    <PaymentElement />
    <button type="submit">
      Pay
    </button>
  </form>
</template>
  1. Customer enters their email address in the Link Authentication Element
  2. If the email is associated with a Link account, the customer can authenticate
  3. Once authenticated, Link automatically fills in saved payment methods and addresses
  4. The customer can complete checkout with a single click

Integration with Payment Element

The Link Authentication Element works seamlessly with the Payment Element:

<template>
  <Elements :stripe="stripePromise">
    <form>
      <LinkAuthenticationElement />
      <PaymentElement />
      <button type="submit">
        Pay
      </button>
    </form>
  </Elements>
</template>

When a customer authenticates with Link, the Payment Element will automatically show their saved payment methods.

For detailed information about the Link Authentication Element and its usage, refer to the Stripe Link Authentication Element documentation.