# Build a checkout with Mobile Checkout Elements

Build a native checkout in your app with Mobile Checkout Elements and the Checkout Sessions API.

Mobile Checkout Elements are modular UI components that you can combine to build a native checkout flow in your app.

This guide shows you how to combine the [Currency Selector Element](https://docs.stripe.com/payments/mobile/checkout-sessions/adaptive-pricing.md), [Express Checkout Element](https://docs.stripe.com/payments/mobile/checkout-sessions/express-checkout-element.md), [Shipping Address Element](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#shipping-address), and [Payment Element](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#payment-element) so customers can pay with express payment options or a traditional payment form.

## How Elements work together

When you create multiple Elements for the same Checkout Session, they automatically share data and coordinate their behavior.

- The Shipping Address Element updates the address used to calculate taxes and totals.
- The Currency Selector Element updates the currency and amounts shown by the other Elements and your app.
- The Express Checkout Element and Payment Element share the same Checkout Session and coordinate confirmation so that only one Element confirms the payment.

Choose the Elements that match your checkout requirements. You don’t need to include all four. Configure the Elements you use with the same controller or `useCheckoutElements` hook so they share the Checkout Session.

| Element | When to use it | How to use it |
| --- | --- | --- |
| [Currency Selector Element](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#currency-selector) | Let eligible customers choose between your integration currency and their local currency with [Adaptive Pricing](https://docs.stripe.com/payments/mobile/checkout-sessions/adaptive-pricing.md). | Place it near the order total so customers can review the amount in their selected currency before paying. It displays only when Adaptive Pricing is available. Render amounts from the latest Session so your order summary reflects currency changes. |
| [Express Checkout Element](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#express-checkout) | Offer express payments with Apple Pay on iOS, Google Pay on Android, and Link when available. | Place it before the standard payment options. It displays buttons based on device and payment method eligibility and confirms the Session as part of the wallet flow. Handle its confirmation result without requiring the customer to tap your **Pay** button afterward. Pair it with the Payment Element for customers who can’t or don’t want to use an express payment method. |
| [Shipping Address Element](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#shipping-address) | Collect a delivery address for orders that require shipping, or let customers edit an existing address. Omit it when you don’t need a shipping address or collect one with your own UI. | Add a control to present the address sheet when the customer adds or edits an address. Set the allowed shipping countries on the Session, and display the saved address and updated tax and totals from the latest Session before confirmation. |
| [Payment Element](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#payment-element) | Let customers select a payment method and enter payment details for your standard checkout flow. | Embed it inline to keep payment fields on your checkout screen, or present it as a sheet from a payment method selection control to keep the screen compact. Display the selected payment option from the Session, then use your own **Pay** button to [confirm the Session](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#confirm-session). |

### 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/build-a-checkout-page" \
  -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

View your [payment methods settings](https://dashboard.stripe.com/settings/payment_methods) and enable the payment methods you want to support. You need at least one payment method enabled to create a *Checkout Session* (A Checkout Session represents your customer's session as they pay for one-time purchases or subscriptions through Checkout. After a successful payment, the Checkout Session contains a reference to the Customer, and either the successful PaymentIntent or an active Subscription).

By default, Stripe enables cards and other common payment methods that can help you reach more customers, but we recommend turning on additional payment methods that are relevant for your business and customers. See [Payment method support](https://docs.stripe.com/payments/payment-methods/payment-method-support.md) for product and payment method support, and our [pricing page](https://stripe.com/pricing/local-payment-methods) for fees.

## 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 following example sets [customer_email](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-customer_email) for a customer whose email you already have on file. If you need to collect or edit an email, follow [Provide the customer email](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#collect-email) to configure the Session for your scenario.

If you collect a shipping address, set [shipping_address_collection.allowed_countries](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-shipping_address_collection-allowed_countries).

```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',
  shipping_address_collection: {
    allowed_countries: ['US', 'CA']
  },
  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.

## Optional: Save payment methods [Server-side]

To save payment methods, associate the Checkout Session with a *Customer* (Customer objects and some v2 Account objects represent customers of your business. They let you reuse payment methods and track multiple payments). When creating the Session, pass an existing Customer ID in the [customer](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-customer) parameter. Alternatively, set [customer_creation](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-customer_creation) to `always` and save the Customer ID returned on the [completed Session](https://docs.stripe.com/api/checkout/sessions/object.md#checkout_session_object-customer).

Next, choose whether saving payment methods is optional or required in your checkout flow. Add the following parameters when creating the Checkout Session. If you use an existing `Customer`, replace `customer_email` with `customer`.

### Let the customer choose

To let customers choose whether to save their payment method for future checkouts, enable [payment_method_save](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-saved_payment_method_options-payment_method_save):

```javascript
const session = await stripe.checkout.sessions.create({
  ui_mode: 'mobile_elements',
  customer: 'cus_123',
  saved_payment_method_options: {
    payment_method_save: 'enabled',
  },
  // Include your line items and other Checkout Session configuration.
});
```

The Payment Element displays a **Save payment details for future purchases** checkbox. If the customer selects it, Stripe saves the payment method with [allow_redisplay](https://docs.stripe.com/api/payment_methods/object.md#payment_method_object-allow_redisplay) set to `always`. To display the saved payment method by default in a later Checkout Session, pass the same Customer ID.

### Save unconditionally

To save payment methods without offering customers a choice at checkout, set [payment_settings.setup_future_usage](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-payment_settings-setup_future_usage):

```javascript
const session = await stripe.checkout.sessions.create({
  ui_mode: 'mobile_elements',
  customer: 'cus_123',
  payment_settings: {
    setup_future_usage: 'off_session',
  },
  // Include your line items and other Checkout Session configuration.
});
```

This saves payment methods without offering customers a choice and limits available payment methods to those that support `setup_future_usage`. To save only specific payment method types, set [setup_future_usage](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-payment_method_options-card-setup_future_usage) for each type instead:

```javascript
const session = await stripe.checkout.sessions.create({
  ui_mode: 'mobile_elements',
  customer: 'cus_123',
  payment_method_options: {
    card: {
      setup_future_usage: 'off_session',
    },
  },
  // Include your line items and other Checkout Session configuration.
});
```

When you save a new payment method this way, Stripe sets [allow_redisplay](https://docs.stripe.com/api/payment_methods/object.md#payment_method_object-allow_redisplay) to `limited` on the saved `PaymentMethod`. By default, Checkout displays only payment methods with `allow_redisplay` set to `always`. To display a payment method saved with `limited` in a later Checkout Session, pass the same Customer ID and include both `always` and `limited` in [allow_redisplay_filters](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-saved_payment_method_options-allow_redisplay_filters):

```javascript
const session = await stripe.checkout.sessions.create({
  ui_mode: 'mobile_elements',
  customer: 'cus_123',
  saved_payment_method_options: {
    allow_redisplay_filters: ['always', 'limited'],
  },
  // Include your line items and other Checkout Session configuration.
});
```

## Configure the controller [Client-side]

Configure each Element that you use, then initialize the `CheckoutElementsController` with those configurations.

Build the controller in a `ViewModel` so its `SavedStateHandle` preserves checkout state across configuration changes and process recreation. Delegate suspending checkout operations from your UI to `ViewModel` methods that run them in `viewModelScope.launch`.

```kotlin
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.launch

class CheckoutViewModel(
    application: Application,
    savedStateHandle: SavedStateHandle,
) : AndroidViewModel(application) {
    val controller = CheckoutElementsController.Builder(
        application = application,
        savedStateHandle = savedStateHandle,
    )
        .resultCallback(::handleCheckoutResult)
        .build()

    fun configure(clientSecret: String) {
        viewModelScope.launch {
            val configuration = CheckoutElementsController.Configuration()
            // Add the configuration for each Element as shown in its section.

            val result = controller.configure(
                clientSecret = clientSecret,
                configuration = configuration,
            )
            if (result is CheckoutElementsController.OperationResult.Failed) {
                showError(result.displayMessage)
            }
        }
    }

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

> Configuring the Currency Selector Element doesn’t guarantee that Adaptive Pricing is available for a Session.

## Provide the customer email [Server-side] [Client-side]

A Checkout Session requires a valid customer email before confirmation. Stripe uses this email for fraud prevention, to recognize returning Link customers, and to send receipts if you enable them. This checkout email is separate from a payment method’s billing email.

Choose the approach that matches your app:

### If you already have an email

If you always have an email on file and don’t need customers to edit it during checkout, set [customer_email](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-customer_email) when you create the Checkout Session, or pass [customer](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-customer) with a `Customer` that has an email. You don’t need an email field in your checkout UI.

An email provided through `customer_email` or `Customer.email` is immutable in the client SDK. Don’t set `defaults.email` or call `updateEmail` for that Session. Attempting to override a server-provided email returns an error.

### If you need to collect or edit an email

If you don’t always have an email, collect it with your own UI. Use this approach if you already have an email but want customers to be able to edit it during checkout.

Don’t set `customer_email` or pass a `Customer` that already has an email. If you have an initial email, set it in the Checkout configuration defaults before initialization:

```kotlin
val configuration = CheckoutElementsController.Configuration()
    .defaults(
        CheckoutElementsController.Configuration.Defaults()
            .email(customerEmail)
    )
    .paymentElement(PaymentElement.Configuration())
```

Populate your email field with that value, and call `updateEmail` when the customer enters or changes their email. Handle validation errors and provide a valid email before confirming the Session. Omitting the email results in a confirmation error.

Delegate email updates to the `ViewModel` so the asynchronous call runs in `viewModelScope`:

```kotlin
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.launch

fun updateEmail(email: String) {
    viewModelScope.launch {
        val result = controller.updateEmail(email)
        if (result is CheckoutElementsController.OperationResult.Failed) {
            showError(result.displayMessage)
        }
    }
}
```

When the customer submits their email address, call `viewModel.updateEmail(email)`.

## Render the order summary [Client-side]

Treat the `CheckoutElementsController`’s session as the source of truth for your checkout UI. Render line items, discounts, tax, shipping, and totals using it. Observe session changes so your UI updates after a customer applies a promotion code, changes an address, selects a currency, or makes other changes, as well as after your app makes changes.

On Android, collect the `CheckoutElementsController.session` and `CheckoutElementsController.isUpdating` `StateFlow` values. Disable controls that mutate or confirm the checkout while `isUpdating` is true.

```kotlin
@Composable
fun CheckoutScreen(
    controller: CheckoutElementsController,
    onConfirm: () -> Unit,
) {
    val session by controller.session.collectAsState()
    val isUpdating by controller.isUpdating.collectAsState()

    Column {
        session?.let { OrderSummary(it) }

        Button(
            onClick = onConfirm,
            enabled = !isUpdating
                && session?.paymentOption != null
                && session?.shippingAddress != null,
        ) {
            Text("Pay")
        }
    }
}
```

## Optional: Add the Currency Selector Element [Client-side]

Add the Currency Selector Element near your order total. It updates the Checkout Session when the customer selects a currency.

The Currency Selector Element displays only when Adaptive Pricing is available. Enable Adaptive Pricing in your [Payments settings](https://dashboard.stripe.com/settings/adaptive-pricing) in the Dashboard, or set [adaptive_pricing.enabled](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-adaptive_pricing-enabled) to `true` on your server when you create the Checkout Session.

Before calling `controller.configure`, add the Currency Selector Element configuration as described in [Configure the controller](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#configure-checkout):

```kotlin
configuration.currencySelectorElement(CurrencySelectorElement.Configuration())
```

After the configuration succeeds, display the Element. Create one presenter for the Activity, and retain the Element instances that it returns.

```kotlin
val presenter = viewModel.controller.createPresenter(this)
val currencySelector = presenter.currencySelectorElement()
```

```kotlin
if (session?.isCurrencySelectorAvailable == true) {
    currencySelector.Content()
}
```

## Optional: Add the Express Checkout Element [Client-side]

The Express Checkout Element displays express payment buttons for Google Pay and Link.

Add it before the standard payment options. It confirms the [Session](https://docs.stripe.com/api/checkout/sessions/object.md) after the customer completes a wallet payment.

After the Checkout Session loads, the Element determines which buttons to display based on the customer’s device, wallet setup, your payment method settings, and the Element configuration.

### Configure the Element

Before calling `controller.configure`, add the Express Checkout Element to the same configuration as your Payment Element and other checkout settings, as described in [Configure the controller](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#configure-checkout). The Element is only available if `configuration.expressCheckoutElement` has been set:

```kotlin
configuration.expressCheckoutElement(ExpressCheckoutElement.Configuration())
```

Google Pay and Link display by default when available. Set either method’s `display` option to `Never` to hide it. Use `googlePayConfiguration` to customize the Google Pay button type.

### Display the Element

After the configuration succeeds, display the Element. Create one presenter for the Activity, and retain the Element instance that it returns.

```kotlin
val expressCheckoutElement = presenter.expressCheckoutElement()
```

Render its content before the Payment Element in your checkout:

```kotlin
expressCheckoutElement.Content()
```

The Express Checkout Element renders no content when no express payment methods are eligible. Keep the Payment Element available as another way to pay. For custom labels or separators, [observe availability](https://docs.stripe.com/payments/mobile/checkout-sessions/express-checkout-element/accept-a-payment.md?platform=android#observe-availability).

For eligibility rules and Stripe-controlled payment method order, see [Enable payment methods](https://docs.stripe.com/payments/mobile/checkout-sessions/express-checkout-element/accept-a-payment.md?platform=android#enable-payment-methods). For customization options, see [Customize the buttons](https://docs.stripe.com/payments/mobile/checkout-sessions/express-checkout-element/accept-a-payment.md?platform=android#customize-buttons).

### Handle confirmation results

The Element sends confirmation results to the callback supplied to `CheckoutElementsController.Builder`. Handle `CheckoutElementsController.Result.Completed`, `CheckoutElementsController.Result.Canceled`, and `CheckoutElementsController.Result.Failed`, as shown when you [confirm the Session](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#confirm-session).

The same callback receives results from the Express Checkout Element and from `presenter.confirm()`. If you need to attribute a result to an Element, record when your app calls `presenter.confirm()` and use that record in the callback.

## Optional: Add the Shipping Address Element [Client-side]

Present the Shipping Address Element when the customer adds or edits a delivery address.

After the customer saves an address, the Element updates the Checkout Session and dismisses.

Read the updated shipping address, tax, and totals from the `CheckoutElementsController.session`.

> If you collect a shipping address, set `shipping_address_collection.allowed_countries` to the countries that are available to ship to on the Checkout Session.

Before calling `controller.configure`, add the Shipping Address Element configuration as described in [Configure the controller](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#configure-checkout):

```kotlin
configuration.shippingAddressElement(ShippingAddressElement.Configuration())
```

Create the presenter when you create the Activity. Wait for the controller configuration to succeed before allowing the customer to add or edit a shipping address.

```kotlin
class CheckoutActivity : ComponentActivity() {
    private val viewModel: CheckoutViewModel by viewModels()

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

        val presenter = viewModel.controller.createPresenter(this)

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

            Button(
                onClick = { presenter.shippingAddressElement().present() },
                enabled = session != null && !isUpdating,
            ) {
                Text(
                    session?.shippingAddress?.address?.line1
                        ?: "Add shipping address"
                )
            }
        }
    }
}
```

## Add the Payment Element [Client-side]

Use the Payment Element to collect a payment method in either of these styles:

- **In a sheet**: Display the selected payment method or a prompt to add one in your checkout. When the customer taps it, open a sheet to collect payment details.
- **In a view**: Display the Payment Element inline in your checkout, alongside your order summary and other Elements.

Both styles use the same Payment Element configuration and update the Session’s selected payment method.

Before calling `controller.configure`, add the Payment Element configuration as described in [Configure the controller](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#configure-checkout):

```kotlin
configuration.paymentElement(PaymentElement.Configuration())
```

After the configuration succeeds, display or present the Element.

### Collect a payment method in a sheet 

Display a button showing the customer’s selected payment method or a prompt to add one. When the customer taps the button, present the Payment Element in a sheet.

Read the selected payment method from the Session, and observe Session changes to keep the button current. Display its `label` and optional `sublabel` so customers can identify the payment method.

Create the presenter during Activity creation and retain the Payment Element it returns:

```kotlin
val presenter = viewModel.controller.createPresenter(this)
val paymentElement = presenter.paymentElement()
```

Call `present()` when the customer taps the payment method button. Collect `controller.session` to display the selection after the sheet closes:

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

Button(
    onClick = paymentElement::present,
    enabled = session != null && !isUpdating,
) {
    val paymentOption = session?.paymentOption
    if (paymentOption == null) {
        Text("Select payment method")
    } else {
        Column {
            Text(paymentOption.label)
            paymentOption.sublabel?.let {
                Text(
                    text = it,
                    style = MaterialTheme.typography.body2,
                )
            }
        }
    }
}
```

### Collect a payment method in a view 

Add the Payment Element to a scrollable view in your checkout. It manages payment method selection, updates the Checkout Session, and resizes as its content changes.

Create the presenter during Activity creation and retain the Payment Element it returns:

```kotlin
val presenter = viewModel.controller.createPresenter(this)
val paymentElement = presenter.paymentElement()
```

Render `Content()` inside a scrollable checkout:

```kotlin
Column(Modifier.verticalScroll(rememberScrollState())) {
    paymentElement.Content()
}
```

## Optional: Hide wallets in the Payment Element [Client-side]

Apply these display settings in the [configuration step](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#configure-checkout), preserving any appearance settings and other options you’ve already configured.

Set the display options before calling `controller.configure`.

Google Pay and Link display in the Payment Element when available. Set a wallet’s `display` to `Never` to hide it from the Payment Element without changing its display in the Express Checkout Element:

```kotlin
val paymentElement = PaymentElement.Configuration()
    .googlePayConfiguration(
        PaymentElement.Configuration.GooglePayConfiguration()
            .display(PaymentElement.Configuration.GooglePayConfiguration.Display.Never)
    )
    .linkConfiguration(
        PaymentElement.Configuration.LinkConfiguration()
            .display(PaymentElement.Configuration.LinkConfiguration.Display.Never)
    )
configuration.paymentElement(paymentElement)
```

To hide the Link button or row only when an existing Link user isn’t detected, use `PaymentElement.Configuration.LinkConfiguration.Display.WalletButtonHidden` instead of `Never`.

## Confirm the Session [Client-side]

Add a **Pay** button to your UI. When the customer taps **Pay**, call `confirm` to confirm the Checkout Session, then handle the result. Keep it disabled while the controller is updating, no payment option is selected, or there is other incomplete data (such as shipping address).

Call `presenter.confirm()` directly from your UI. It isn’t a suspending function.

```kotlin
Button(
    onClick = presenter::confirm,
    enabled = !isUpdating
        && session?.paymentOption != null
        && session?.shippingAddress != null,
) {
    Text("Pay")
}
```

Handle results in the callback supplied to `CheckoutElementsController.Builder`:

```kotlin
private fun handleCheckoutResult(result: CheckoutElementsController.Result) {
    when (result) {
        is CheckoutElementsController.Result.Completed -> showOrderConfirmation()
        is CheckoutElementsController.Result.Canceled -> restoreCheckout()
        is CheckoutElementsController.Result.Failed -> showError(result.error)
    }
}
```

## Fulfill the order [Server-side]

Follow the [mobile Checkout fulfillment guide](https://docs.stripe.com/payments/mobile/checkout-sessions/fulfillment.md) to fulfill orders on your server. Check the Session’s payment status before fulfillment and make fulfillment safe to run multiple times. For delayed payment methods, wait for payment success before fulfilling.

Verify webhook signatures to confirm that events came from Stripe. See [verify webhook signatures](https://docs.stripe.com/events/manage-webhook-endpoints.md#signature-errors).

## Test the integration

#### Cards

| Card number         | Scenario                                                                                                                                                                                                                                                                                      | How to test                                                                                           |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| 4242424242424242    | The card payment succeeds and doesn’t require authentication.                                                                                                                                                                                                                                 | Fill out the credit card form using the credit card number with any expiration, CVC, and postal code. |
| 4000002500003155    | The card payment requires *authentication* (Strong Customer Authentication (SCA) is a regulatory requirement in effect as of September 14, 2019, that impacts many European online payments. It requires customers to use two-factor authentication like 3D Secure to verify their purchase). | Fill out the credit card form using the credit card number with any expiration, CVC, and postal code. |
| 4000000000009995    | The card is declined with a decline code like `insufficient_funds`.                                                                                                                                                                                                                           | Fill out the credit card form using the credit card number with any expiration, CVC, and postal code. |
| 6205500000000000004 | The UnionPay card has a variable length of 13-19 digits.                                                                                                                                                                                                                                      | Fill out the credit card form using the credit card number with any expiration, CVC, and postal code. |

#### Bank redirects

| Payment method    | Scenario                                                                                                                                                                                        | How to test                                                                                                                                              |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Bancontact, iDEAL | Your customer fails to authenticate on the redirect page for a redirect-based and immediate notification payment method.                                                                        | Choose any redirect-based payment method, fill out the required details, and confirm the payment. Then click **Fail test payment** on the redirect page. |
| Pay by Bank       | Your customer successfully pays with a redirect-based and [delayed notification](https://docs.stripe.com/payments/payment-methods.md#payment-notification) payment method.                      | Choose the payment method, fill out the required details, and confirm the payment. Then click **Complete test payment** on the redirect page.            |
| Pay by Bank       | Your customer fails to authenticate on the redirect page for a redirect-based and delayed notification payment method.                                                                          | Choose the payment method, fill out the required details, and confirm the payment. Then click **Fail test payment** on the redirect page.                |
| BLIK              | BLIK payments fail in a variety of ways—immediate failures (for example, the code is expired or invalid), delayed errors (the bank declines) or timeouts (the customer didn’t respond in time). | Use email patterns to [simulate the different failures.](https://docs.stripe.com/payments/blik/accept-a-payment.md#simulate-failures)                    |

#### Bank debits

| Payment method    | Scenario                                                                                          | How to test                                                                                                                                                                                       |
| ----------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SEPA Direct Debit | Your customer successfully pays with SEPA Direct Debit.                                           | Fill out the form using the account number `AT321904300235473204`. The confirmed PaymentIntent initially transitions to processing, then transitions to the succeeded status three minutes later. |
| SEPA Direct Debit | Your customer’s payment intent status transitions from `processing` to `requires_payment_method`. | Fill out the form using the account number `AT861904300235473202`.                                                                                                                                |

See [Testing](https://docs.stripe.com/testing.md) for additional information to test your integration.

## Optional: Handle user logout [Client-side]

Mobile Checkout Elements store information locally to remember whether a customer has used Link in your app. If your app supports customer accounts, clear this stored authentication state when the customer logs out.

Call `CheckoutElementsController.clearLocalCustomerData(context)` with your application context as part of your app’s logout logic.

```kotlin
import android.content.Context
import com.stripe.android.checkout.CheckoutElementsController
import com.stripe.android.paymentelement.CheckoutSessionPreview

@OptIn(CheckoutSessionPreview::class)
fun handleLogout(context: Context) {
    CheckoutElementsController.clearLocalCustomerData(context.applicationContext)
    // Other logout logic required by your app.
}
```

