# Accept a payment with the Express Checkout Element

Use a single integration to accept payments through express payment buttons.

The [Express Checkout Element](https://docs.stripe.com/payments/mobile/checkout-sessions/express-checkout-element.md) accepts payments through express payment buttons for supported wallets, including Apple Pay, Google Pay, and Link.

Customers see different payment buttons depending on their device, wallet setup, your payment method settings, and Element configuration. When a customer completes the wallet flow, the Express Checkout Element confirms the Checkout Session. You don’t need a separate Pay button for express payments.

The Express Checkout Element reads the Checkout Session to determine which payment methods are available and displays line items and total amount in Apple Pay and Google Pay.

To add express payments to an existing Payment Element integration or combine multiple Elements, follow [Build a checkout page with multiple Elements](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#express-checkout).

This guide uses Checkout Sessions. If your checkout uses Payment Intents, [migrate to Checkout Sessions](https://docs.stripe.com/payments/mobile/checkout-sessions/migrate-from-payment-intents.md) first.

### Want access to Mobile Checkout Elements?

Mobile Checkout Elements is in private preview. Share your email address to request access.

```bash
curl https://docs.stripe.com/preview/register \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Referer: https://docs.stripe.com/payments/mobile/checkout-sessions/express-checkout-element/accept-a-payment" \
  -d '{"email": "EMAIL", "preview": "elements_beta_preview"}'
```

# Android


## Set up Stripe [Server-side] [Client-side]

First, you need a Stripe account. [Register now](https://dashboard.stripe.com/register).

### Server-side 

This integration requires endpoints on your server that talk to the Stripe API. Use the official libraries for access to the Stripe API from your server:

#### Ruby

```bash
# Available as a gem
sudo gem install stripe
```

```ruby
# If you use bundler, you can add this line to your Gemfile
gem 'stripe'
```

### Client-side 

The [Stripe Android SDK](https://github.com/stripe/stripe-android) is open source and [fully documented](https://stripe.dev/stripe-android/).

To install the SDK, add `stripe-android` to the `dependencies` block of your [app/build.gradle](https://developer.android.com/studio/build/dependencies) file:

#### Kotlin

```kotlin
plugins {
    id("com.android.application")
    id("org.jetbrains.kotlin.android")
    id("org.jetbrains.kotlin.plugin.compose")
}

android {
    ...
    kotlinOptions {
        jvmTarget = "11"
    }
    buildFeatures {
        compose true
    }
}

dependencies {
  // ...

  // Stripe Android SDK
  implementation("com.stripe:stripe-android:23.26.0")
  // Include the financial connections SDK to support US bank account as a payment method
  implementation("com.stripe:financial-connections:23.26.0")
}
```

> For details on the latest SDK release and past versions, see the [Releases](https://github.com/stripe/stripe-android/releases) page on GitHub. To receive notifications when a new release is published, [watch releases for the repository](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#configuring-your-watch-settings-for-an-individual-repository).

Mobile Checkout Elements renders inline Elements with Jetpack Compose. Render your checkout page and inline Elements from composable functions.

You also need to set your [publishable key](https://dashboard.stripe.com/apikeys) so that the SDK can make API calls to Stripe. To get started quickly, you can hardcode this on the client while you’re integrating, but fetch the publishable key from your server in production.

```kotlin
// Set your publishable key: remember to change this to your live publishable key in production
// See your keys here: https://dashboard.stripe.com/apikeys
PaymentConfiguration.init(context, publishableKey = "<<YOUR_PUBLISHABLE_KEY>>")
```

Opt in on each class or function that uses Mobile Checkout Elements:

```kotlin
import com.stripe.android.paymentelement.CheckoutSessionPreview

@OptIn(CheckoutSessionPreview::class)
class CheckoutViewModel : ViewModel() {
    // Configure CheckoutElementsController here.
}
```

Private-preview API names and behavior can change before public preview.

## Enable payment methods

The Element displays eligible payment methods based on your [payment method settings](https://dashboard.stripe.com/settings/payment_methods), Element configuration, and the customer’s device and wallet setup. Stripe determines button order from the Session, filtered for eligibility and layout capacity. 

### Payment method availability 

Each payment method has its own setup requirements and display controls. To hide a button, see [Hide a payment method](https://docs.stripe.com/payments/mobile/checkout-sessions/express-checkout-element/accept-a-payment.md#hide-payment-method).

#### Google Pay

Google Pay displays by default on Android when the customer’s device and wallet are eligible.

#### Link

Link displays by default when eligible.

Link isn’t available in the Express Checkout Element when the Checkout Session requires a shipping address or calculates automatic tax from the billing address. The web-based Link fallback also isn’t available when the Session requires a billing address.

When no payment methods are eligible, the Element renders no content. Keep another payment path available or explain why express payment isn’t available. You can [observe availability](https://docs.stripe.com/payments/mobile/checkout-sessions/express-checkout-element/accept-a-payment.md#observe-availability) to hide surrounding labels or separators.

## Create a Checkout Session [Server-side]

You must have access to the Mobile Checkout Elements private preview and use API version `2026-03-25.preview` or a later preview version. Set your server SDK’s API version explicitly, including the `.preview` suffix.

On your server, [create a Checkout Session](https://docs.stripe.com/api/checkout/sessions/create.md) when the customer starts checkout. Set [ui_mode](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-ui_mode) to `mobile_elements` and provide at least one item in [items](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-items) with its [type](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-items-type) set to `one_time_price`.

If you enable [automatic tax](https://docs.stripe.com/payments/mobile/checkout-sessions/collect-taxes.md) with `automatic_tax[enabled]=true`, you must also set [invoice_creation[enabled]](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-invoice_creation-enabled) to `true`.

The Checkout Session must have a valid customer email before confirmation. This guide provides the email on the server: pass a [Customer](https://docs.stripe.com/api/customers.md) with an email or set [customer_email](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-customer_email), as shown in the example.

```javascript
// Don't put any keys in code. See /keys-best-practices.
const stripe = require('stripe')('<<YOUR_SECRET_KEY>>', {
  apiVersion: '2026-11-18.preview',
});

const session = await stripe.checkout.sessions.create({
  ui_mode: 'mobile_elements',
  customer_email: 'jenny.rosen@example.com',
  items: [
    {
      type: 'one_time_price',
      one_time_price: {
        items: [
          {
            price_data: {
              currency: 'usd',
              unit_amount: 5000,
              product_data: {
                name: 'Painting class fee',
                description: '1-hour painting class',
              },
            },
            quantity: 1,
          },
        ],
      },
    },
  ],
});

res.json({clientSecret: session.client_secret});
```

The private preview supports the `one_time_price` type only.

## Configure the Express Checkout Element [Client-side]

Set the Express Checkout Element configuration when you configure the controller. The Element isn’t available without this configuration. Google Pay and Link display by default when available.

Build the controller in a `ViewModel` and pass its `SavedStateHandle` to the builder. Define `handleCheckoutResult` in the same class before registering it with the builder. The callback exposes payment results for your UI to handle in [Handle payment results](https://docs.stripe.com/payments/mobile/checkout-sessions/express-checkout-element/accept-a-payment.md#handle-payment-results).

Call the ViewModel’s `configure` function to fetch the client secret and configure the controller in `viewModelScope`. Implement `fetchClientSecret` to call the endpoint from [Create a Checkout Session](https://docs.stripe.com/payments/mobile/checkout-sessions/express-checkout-element/accept-a-payment.md#create-checkout-session) and return its client secret.

```kotlin
import android.app.Application
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.viewModelScope
import com.stripe.android.checkout.CheckoutElementsController
import com.stripe.android.elements.ExpressCheckoutElement
import com.stripe.android.paymentelement.CheckoutSessionPreview
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch

@OptIn(CheckoutSessionPreview::class)
class CheckoutViewModel(
    application: Application,
    savedStateHandle: SavedStateHandle,
) : AndroidViewModel(application) {
    private val _loadError = MutableStateFlow<String?>(null)
    val loadError: StateFlow<String?> = _loadError.asStateFlow()

    private val _checkoutResult = MutableStateFlow<CheckoutElementsController.Result?>(null)
    val checkoutResult: StateFlow<CheckoutElementsController.Result?> = _checkoutResult.asStateFlow()

    private fun handleCheckoutResult(result: CheckoutElementsController.Result) {
        _checkoutResult.value = result
    }

    fun clearCheckoutResult() {
        _checkoutResult.value = null
    }

    val controller = CheckoutElementsController.Builder(
        application = application,
        savedStateHandle = savedStateHandle,
    )
        .resultCallback(::handleCheckoutResult)
        .build()

    private var configureJob: Job? = null

    fun configure() {
        if (configureJob?.isActive == true || controller.session.value != null) return

        configureJob = viewModelScope.launch {
            _loadError.value = null
            try {
                val clientSecret = fetchClientSecret()
                val configuration = CheckoutElementsController.Configuration()
                    .expressCheckoutElement(ExpressCheckoutElement.Configuration())

                val result = controller.configure(
                    clientSecret = clientSecret,
                    configuration = configuration,
                )
                if (result is CheckoutElementsController.OperationResult.Failed) {
                    if (result.error is CancellationException) throw result.error
                    _loadError.value = result.displayMessage
                }
            } catch (error: CancellationException) {
                throw error
            } catch (error: Exception) {
                _loadError.value = "Unable to load checkout. Try again later."
            }
        }
    }

    private suspend fun fetchClientSecret(): String =
        TODO("Make a request to your server to fetch the Checkout Session client secret.")

    override fun onCleared() {
        controller.destroy()
        super.onCleared()
    }
}
```

Display loading and error states, and render checkout content only after configuration succeeds.

## Display the Express Checkout Element [Client-side]

Create one presenter during Activity creation and retain the Element instance it returns. Show loading and error states while fetching the client secret and configuring the controller. Display the Element only after configuration succeeds:

```kotlin
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.Text
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import com.stripe.android.checkout.CheckoutElementsController
import com.stripe.android.paymentelement.CheckoutSessionPreview

@OptIn(CheckoutSessionPreview::class)
class CheckoutActivity : ComponentActivity() {
    private val viewModel: CheckoutViewModel by viewModels()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val presenter = viewModel.controller.createPresenter(this)
        val expressCheckoutElement = presenter.expressCheckoutElement()
        viewModel.configure()

        setContent {
            val session by viewModel.controller.session.collectAsState()
            val loadError by viewModel.loadError.collectAsState()

            when {
                loadError != null -> Text(loadError.orEmpty())
                session == null -> CircularProgressIndicator()
                else -> expressCheckoutElement.Content()
            }
        }
    }
}
```

The Express Checkout Element handles confirmation when the customer taps its button; your app doesn’t need to call `presenter.confirm()` for express payments.

The Element renders no content when no payment methods are available. Provide another checkout path or explain that express payment isn’t available rather than leaving the customer with an empty payment screen.

## Handle payment results [Client-side]

The [configured callback](https://docs.stripe.com/payments/mobile/checkout-sessions/express-checkout-element/accept-a-payment.md#configure-express-checkout) updates the ViewModel’s `checkoutResult` state. Inside the Activity’s `setContent` block from [Display the Express Checkout Element](https://docs.stripe.com/payments/mobile/checkout-sessions/express-checkout-element/accept-a-payment.md#present-express-checkout), handle that state in a `LaunchedEffect`. Replace `showOrderConfirmation`, `restoreCheckout`, and `showError` with your app’s UI actions:

```kotlin
val checkoutResult by viewModel.checkoutResult.collectAsState()

LaunchedEffect(checkoutResult) {
    when (val result = checkoutResult) {
        is CheckoutElementsController.Result.Completed -> showOrderConfirmation()
        is CheckoutElementsController.Result.Canceled -> restoreCheckout()
        is CheckoutElementsController.Result.Failed -> showError(result.error)
        null -> Unit
    }
    viewModel.clearCheckoutResult()
}
```

Clear the result after handling it so recreating the Activity doesn’t repeat the UI action.

Use [Checkout Session webhooks](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md?platform=android#fulfill-order) on your server to fulfill orders, rather than relying only on the client-side result callback. [Verify webhook signatures](https://docs.stripe.com/webhooks.md#verify-events) before processing events to confirm they came from Stripe. If your server uses network allowlisting, allow requests from [Stripe’s public IP addresses](https://docs.stripe.com/ips.md#webhook-notifications).

## Test the integration

Before you go live, use your Stripe test API keys to test each enabled payment method on a supported device.

### Google Pay

Add a real card to Google Wallet so that Google Pay is available on your test device. Use Google’s [Android test card suite](https://developers.google.com/pay/api/android/guides/resources/test-card-suite) to test payment scenarios with Stripe test cards. See [test Google Pay](https://docs.stripe.com/google-pay.md?platform=android#test-google-pay).

### Test Link

> Don’t store real user data in *sandbox* (A sandbox is an isolated test environment that allows you to test Stripe functionality in your account without affecting your live integration. Use sandboxes to safely experiment with new features and changes) Link accounts. Treat them as if they’re publicly available, because these test accounts are associated with your publishable key.

Link supports credit cards, debit cards, and qualified US bank account purchases.

You can create sandbox accounts for Link using any valid email address. The following table shows the fixed one-time passcode values that Stripe accepts for authenticating sandbox accounts:

| Value                               | Outcome                      |
| ----------------------------------- | ---------------------------- |
| Any other 6 digits not listed below | Success                      |
| 000001                              | Error, code invalid          |
| 000002                              | Error, code expired          |
| 000003                              | Error, max attempts exceeded |

### Check checkout behavior

Test successful payments, cancellation, and error handling. Confirm that your server receives the [checkout.session.completed](https://docs.stripe.com/api/events/types.md#event_types-checkout.session.completed) event and fulfills the order only after payment succeeds. Also test a device with no eligible wallet and verify that your UI provides another way to pay or explains why express payment isn’t available.

If your checkout displays other payment options, test those paths too. Test Sessions that require shipping or billing addresses and Sessions with automatic tax enabled. Check that the eligible buttons match the [payment method compatibility rules](https://docs.stripe.com/payments/mobile/checkout-sessions/express-checkout-element/accept-a-payment.md#enable-payment-methods). Rotate the device during checkout and verify that state and result handling remain correct.

## Optional: Hide a payment method [Client-side]

To hide Link:

```kotlin
val expressCheckout = ExpressCheckoutElement.Configuration()
    .linkConfiguration(
        ExpressCheckoutElement.Configuration.LinkConfiguration()
            .display(
                ExpressCheckoutElement.Configuration.LinkConfiguration.Display.Never
            )
    )
configuration.expressCheckoutElement(expressCheckout)
```

To hide Google Pay, set its `display` option to `Never` in `googlePayConfiguration`. See [payment method availability](https://docs.stripe.com/payments/mobile/checkout-sessions/express-checkout-element/accept-a-payment.md#check-available-payment-methods).

## Optional: Observe available payment methods [Client-side]

Collect `controller.session` and read `availableExpressCheckoutPaymentMethods`, a `Set<ExpressCheckoutElement.PaymentMethod>` containing eligible methods (`GooglePay` and `Link` instances). An empty set means no buttons display. Buttons aren’t available until the initial Session load completes. The set doesn’t expose [the Stripe-controlled display order](https://docs.stripe.com/payments/mobile/checkout-sessions/express-checkout-element/accept-a-payment.md#enable-payment-methods).

Use this state to hide surrounding labels or separators, animate the Element, or record which payment methods are available:

```kotlin
val session by controller.session.collectAsState()

AnimatedVisibility(
    visible = session?.availableExpressCheckoutPaymentMethods
        ?.isNotEmpty() == true,
    enter = expandVertically() + fadeIn(),
) {
    expressCheckoutElement.Content()
}
```

## Optional: Track the confirmation source [Client-side]

If you use both the Express Checkout Element and Payment Element and want to attribute payment results, record when your app calls `presenter.confirm()`. The shared result callback doesn’t identify which Element initiated confirmation. When you display only the Express Checkout Element, you don’t need this tracking.

Replace `handleCheckoutResult` in your `ViewModel` with this example. Reset the flag for every result, including cancellations and failures, and forward results through `checkoutResult`:

```kotlin
private var calledConfirm = false

fun reportConfirm() {
    calledConfirm = true
}

private fun handleCheckoutResult(result: CheckoutElementsController.Result) {
    val source = if (calledConfirm) "payment_element" else "express_checkout_element"
    calledConfirm = false
    // Record source in your analytics.
    _checkoutResult.value = result
}
```

Record the source only when your app calls `presenter.confirm()` for the Payment Element. Keep its payment button disabled while the controller is updating or required checkout data is incomplete, as described in [confirm the Session](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md?platform=android#confirm-session).

```kotlin
Button(
    onClick = {
        viewModel.reportConfirm()
        presenter.confirm()
    },
    enabled = canPay,
) {
    Text("Pay")
}
```


## Optional: Customize the buttons [Client-side]

Customize the button layout, type, theme, and corner radius to fit your checkout. Wallet providers control their logos and brand colors. 

Apply these options when [configuring the Element](https://docs.stripe.com/payments/mobile/checkout-sessions/express-checkout-element/accept-a-payment.md#configure-express-checkout). Combine the options you need in the same configuration:

- On iOS, update `expressCheckout` before assigning it to `configuration.expressCheckoutElement`.
- On Android, add the builder calls to your `ExpressCheckoutElement.Configuration()` before passing it to `configuration.expressCheckoutElement(...)`.
- In React Native, add the fields to the `expressCheckoutElement` configuration returned by `getConfiguration`. Keep the existing `onResult` callback.

### Button layout 

By default, the Express Checkout Element arranges the available buttons in a single column within your app’s layout.

You can specify a grid layout with the `buttonLayout` options. `maxColumns` and `maxRows` each accept values from 1 through 10, or you can leave them unset for no limit. Choose a layout with enough space for all eligible buttons.

For example, allow up to two columns and one row:

#### iOS

```swift
expressCheckout.appearance.buttonLayout.maxColumns = 2
expressCheckout.appearance.buttonLayout.maxRows = 1
```

#### Android

```kotlin
val expressCheckout = ExpressCheckoutElement.Configuration()
    .appearance(
        ExpressCheckoutElement.Configuration.Appearance()
            .buttonLayout(
                ExpressCheckoutElement.Configuration.Appearance.ButtonLayout()
                    .maxColumns(2)
                    .maxRows(1)
            )
    )
```

#### React Native

```tsx
appearance: {
  buttonLayout: { maxColumns: 2, maxRows: 1 },
},
```

### Button type 

Choose a button type to set a supported call to action. Each wallet offers its own types.

#### Apple Pay

The default button type is `plain`. Apple Pay localizes the button text for the customer’s device.

For example, use the `buy` button type:

#### iOS

Set `applePayConfiguration.buttonType` to a `PKPaymentButtonType`:

```swift
expressCheckout.applePayConfiguration.buttonType = .buy
```

#### React Native

Set `applePay.buttonType` to a string:

```tsx
applePay: { buttonType: 'buy' },
```

| iOS value | React Native value | Call to action | Minimum iOS version |
| --- | --- | --- | --- |
| `.plain` | `plain` | None (Apple Pay logo only) | 8.3 |
| `.buy` | `buy` | “Buy with” | 8.3 |
| `.setUp` | `setUp` | “Set up” | 9.0 |
| `.inStore` | `inStore` | “Pay with” | 10.0 |
| `.donate` | `donate` | “Donate with” | 10.2 |
| `.checkout` | `checkout` | “Check Out with” | 12.0 |
| `.book` | `book` | “Book with” | 12.0 |
| `.subscribe` | `subscribe` | “Subscribe with” | 12.0 |
| `.reload` | `reload` | “Reload with” | 14.0 |
| `.addMoney` | `addMoney` | “Add Money with” | 14.0 |
| `.topUp` | `topUp` | “Top Up with” | 14.0 |
| `.order` | `order` | “Order with” | 14.0 |
| `.rent` | `rent` | “Rent with” | 14.0 |
| `.support` | `support` | “Support with” | 14.0 |
| `.contribute` | `contribute` | “Contribute with” | 14.0 |
| `.tip` | `tip` | “Tip with” | 14.0 |
| `.continue` | `continue` | “Continue with” | 15.0 |

Choose a type that matches the payment action. For example, `.setUp` is intended for adding a card to Apple Pay, while the Express Checkout Element starts a payment when tapped. See the [Apple Pay button guidelines](https://developer.apple.com/design/human-interface-guidelines/apple-pay#Using-Apple-Pay-buttons) for usage requirements.

#### Google Pay

The default button type is `pay`. Google Pay localizes the button text for the customer’s device.

For example, use the `buy` button type:

#### Android

Set `GooglePayConfiguration.buttonType` to a `ButtonType`:

```kotlin
val expressCheckout = ExpressCheckoutElement.Configuration()
    .googlePayConfiguration(
        ExpressCheckoutElement.Configuration.GooglePayConfiguration()
            .buttonType(
                ExpressCheckoutElement.Configuration.GooglePayConfiguration.ButtonType.Buy
            )
    )
```

#### React Native

Set `googlePay.buttonType` to a string:

```tsx
googlePay: { buttonType: 'buy' },
```

| Android value | React Native value | Call to action |
| --- | --- | --- |
| `Plain` | `plain` | None (Google Pay logo only) |
| `Book` | `book` | “Book with” |
| `Buy` | `buy` | “Buy with” |
| `Checkout` | `checkout` | “Checkout with” |
| `Donate` | `donate` | “Donate with” |
| `Order` | `order` | “Order with” |
| `Pay` | `pay` | “Pay with” |
| `Subscribe` | `subscribe` | “Subscribe with” |

See the [Google Pay Android button options](https://developers.google.com/pay/api/android/reference/request-objects#ButtonOptions) for usage requirements.

#### Link

Link controls its button content, which can vary with the available space and the customer’s account. You can’t configure its button type.

### Button theme 

Set `appearance.buttonTheme` to a value that contrasts with your checkout background. The theme doesn’t affect Link buttons, which retain their required brand styling. The default is `automatic`.

For example, use the dark theme on a light background:

#### iOS

```swift
expressCheckout.appearance.buttonTheme = .dark
```

#### Android

```kotlin
val expressCheckout = ExpressCheckoutElement.Configuration()
    .appearance(
        ExpressCheckoutElement.Configuration.Appearance()
            .buttonTheme(
                ExpressCheckoutElement.Configuration.Appearance.ButtonTheme.Dark
            )
    )
```

#### React Native

```tsx
appearance: {
  buttonTheme: 'dark',
},
```

| iOS value | Android value | React Native value | Button appearance |
| --- | --- | --- | --- |
| `.light` | `Light` | `light` | Light button for a dark background. |
| `.dark` | `Dark` | `dark` | Dark button for a light background. |
| `.automatic` | `Automatic` | `automatic` | Adapts to the system appearance on iOS and React Native. Contrasts with the current system theme on Android. |

### Corner radius 

Set the corner radius to control button rounding. The value is in points on iOS and density-independent pixels on Android.

#### iOS

```swift
expressCheckout.appearance.cornerRadius = 12
```

#### Android

```kotlin
val expressCheckout = ExpressCheckoutElement.Configuration()
    .appearance(
        ExpressCheckoutElement.Configuration.Appearance()
            .cornerRadiusDp(12f)
    )
```

#### React Native

```tsx
appearance: {
  borderRadius: 12,
},
```
