# 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"}'
```

# React Native


## 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 [React Native SDK](https://github.com/stripe/stripe-react-native) is open source and fully documented. Internally, it uses the [native iOS](https://github.com/stripe/stripe-ios) and [Android](https://github.com/stripe/stripe-android) SDKs. To install Stripe’s React Native SDK, run one of the following commands in your project’s directory (depending on which package manager you use):

#### yarn

```bash
yarn add @stripe/stripe-react-native
```

#### npm

```bash
npm install @stripe/stripe-react-native
```

Next, install some other necessary dependencies:

- For iOS, go to the **ios** directory and run `pod install` to make sure that you also install the required native dependencies.
- For Android, there are no more dependencies to install.

> We recommend following the [official TypeScript guide](https://reactnative.dev/docs/typescript#adding-typescript-to-an-existing-project) to add TypeScript support.

### Stripe initialization

To initialize Stripe in your React Native app, either wrap your payment screen with the `StripeProvider` component, or use the `initStripe` initialization method. Only the API [publishable key](https://docs.stripe.com/keys.md#obtain-api-keys) in `publishableKey` is required. The following example shows how to initialize Stripe using the `StripeProvider` component.

```jsx
import { useState, useEffect } from 'react';
import { StripeProvider } from '@stripe/stripe-react-native';

function App() {
  const [publishableKey, setPublishableKey] = useState('');

  const fetchPublishableKey = async () => {
    const key = await fetchKey(); // fetch key from your server here
    setPublishableKey(key);
  };

  useEffect(() => {
    fetchPublishableKey();
  }, []);

  return (
    <StripeProvider
      publishableKey={publishableKey}
      merchantIdentifier="merchant.identifier" // required for Apple Pay
      urlScheme="your-app" // required for 3D Secure and bank redirects
    >
      {/* Your app code here */}
    </StripeProvider>
  );
}
```

> Use your API [test keys](https://docs.stripe.com/keys.md#obtain-api-keys) while you test and develop, and your [live mode](https://docs.stripe.com/keys.md#test-live-modes) keys when you publish your app.

Import the Mobile Checkout Elements private-preview APIs from their internal SDK paths:

```tsx
import { useCheckoutElements } from '@stripe/stripe-react-native/src/hooks/useCheckoutElements';
import { CheckoutCurrencySelectorElementView } from '@stripe/stripe-react-native/src/components/CheckoutCurrencySelectorElementView';
import { CheckoutPaymentElementView } from '@stripe/stripe-react-native/src/components/CheckoutPaymentElementView';
import { ExpressCheckoutElementView } from '@stripe/stripe-react-native/src/components/ExpressCheckoutElementView';
```

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.

## Set up a return URL [Client-side]

When a customer exits your app (for example to authenticate in Safari or their banking app), provide a way for them to automatically return to your app. Many payment method types *require* a return URL. If you don’t provide one, we can’t present payment methods that require a return URL to your users, even if you’ve enabled them.

To provide a return URL:

1. [Register](https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app#Register-your-URL-scheme) a custom URL. Universal links aren’t supported.
2. [Configure](https://reactnative.dev/docs/linking) your custom URL.
3. Set up your root component to forward the URL to the Stripe SDK as shown below.

> If you’re using Expo, [set your scheme](https://docs.expo.io/guides/linking/#in-a-standalone-app) in the `app.json` file.

```jsx
import { useEffect, useCallback } from 'react';
import { Linking, View } from 'react-native';
import { useStripe } from '@stripe/stripe-react-native';

export default function MyApp() {
  const { handleURLCallback } = useStripe();

  const handleDeepLink = useCallback(
    async (url: string | null) => {
      if (url) {
        const stripeHandled = await handleURLCallback(url);
        if (stripeHandled) {
          // This was a Stripe URL - you can return or add extra handling here as you see fit
        } else {
          // This was NOT a Stripe URL – handle as you normally would
        }
      }
    },
    [handleURLCallback]
  );

  useEffect(() => {
    const getUrlAsync = async () => {
      const initialUrl = await Linking.getInitialURL();
      handleDeepLink(initialUrl);
    };

    getUrlAsync();

    const deepLinkListener = Linking.addEventListener(
      'url',
      (event: { url: string }) => {
        handleDeepLink(event.url);
      }
    );

    return () => deepLinkListener.remove();
  }, [handleDeepLink]);

  return (
    <View>
      <AwesomeAppComponent />
    </View>
  );
}
```

For more information on native URL schemes, refer to the [Android](https://developer.android.com/training/app-links/deep-linking) and [iOS](https://developer.apple.com/documentation/xcode/allowing_apps_and_websites_to_link_to_your_content/defining_a_custom_url_scheme_for_your_app) docs.

## 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 Checkout [Client-side]

Configure each Element that you use, then pass those configurations to the `useCheckoutElements` hook.

Load Checkout before you display your checkout content. Render the checkout after `session` is available.

```tsx
import { useCallback } from 'react';
import { ActivityIndicator, Button, Text, View } from 'react-native';
import { useCheckoutElements } from '@stripe/stripe-react-native/src/hooks/useCheckoutElements';
import type { CheckoutElements } from '@stripe/stripe-react-native/src/types/CheckoutElements';
import { CheckoutContent } from './CheckoutContent';

export default function CheckoutScreen() {
  const getConfiguration = useCallback(
    async (): Promise<CheckoutElements.CreateOptions> => {
      // Create a Checkout Session on your server and return its client secret.
      const { clientSecret } = await fetchCheckoutSession();
      return {
        clientSecret,
        returnURL: 'your-app://stripe-redirect',
        // Add the configuration for each Element as shown in its section.
      };
    },
    []
  );

  const checkout = useCheckoutElements({ getConfiguration });

  if (checkout.status === 'error') {
    return (
      <View>
        <Text>{checkout.error?.message}</Text>
        <Button
          title="Try again"
          // useCheckoutElements reports load failures through `checkout.error`.
          onPress={() => checkout.reload().catch(() => {})}
        />
      </View>
    );
  }

  if (!checkout.session) {
    return <ActivityIndicator />;
  }

  return <CheckoutContent checkout={checkout} />;
}
```

## Optional: Configure Apple Pay for Checkout Elements [Client-side]

To enable Apple Pay on iOS, [configure your app for Apple Pay](https://docs.stripe.com/apple-pay.md?platform=react-native#merchantid) and set `merchantIdentifier` on the `StripeProvider` that wraps your checkout. Replace `merchant.com.example` with your Apple merchant identifier:

```tsx
<StripeProvider
  publishableKey="<<YOUR_PUBLISHABLE_KEY>>"
  merchantIdentifier="merchant.com.example"
>
  <CheckoutScreen />
</StripeProvider>
```

This enables Apple Pay for both the Express Checkout Element and Payment Element.

## 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:

Return the default email in the options from `getConfiguration`:

```tsx
defaults: { email: customerEmail },
```

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.

## Render the order summary [Client-side]

Treat the `session` from `useCheckoutElements` 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.

Read `session` and `status` from `useCheckoutElements`. The hook re-renders your component when either value changes. Disable controls that mutate or confirm the checkout unless `status` is `ready`.

```tsx
import { Text, View } from 'react-native';
import type { CheckoutElements } from '@stripe/stripe-react-native/src/types/CheckoutElements';

export function CheckoutContent({
  checkout,
}: {
  checkout: CheckoutElements.UseResult;
}) {
  const { session } = checkout;

  return (
    <View>
      {session?.orderSummaryItems
        .flatMap((group) => group.items)
        .map((item) => (
          <Text key={item.key}>
            {item.displayName} × {item.quantity}: {item.amountDetails.total.amount}
          </Text>
        ))}
      <Text>Total {session?.totals.total.amount}</Text>
    </View>
  );
}
```

## 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.

Add the Currency Selector Element configuration to the object that `getConfiguration` returns in [Configure Checkout](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#configure-checkout):

```tsx
currencySelectorElement: {
  appearance: { labelContent: 'amount' },
},
```

Then display the configured Element:

```tsx
{checkout.currencySelectorElement && (
  <CheckoutCurrencySelectorElementView
    element={checkout.currencySelectorElement}
  />
)}
```

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

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

The React Native Express Checkout Element displays Apple Pay on iOS, Google Pay on Android, and Link on both platforms.

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

Add `expressCheckoutElement` to the object returned by `getConfiguration` in [Configure Checkout](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#configure-checkout). Keep your existing Payment Element configuration and use the same hook and Session for both Elements:

```tsx
expressCheckoutElement: {
  onResult: handleExpressCheckoutResult,
},
```

Define `handleExpressCheckoutResult` as described in [Handle confirmation results](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#express-checkout-results). To enable Apple Pay, [configure your app for Apple Pay](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#configure-apple-pay).

Google Pay on Android and Link display by default when available. Set either method’s `display` option to `never` to hide it. Use `googlePay.buttonType` to customize the Google Pay button type. 

### Display the Element

Render `ExpressCheckoutElementView` before the Payment Element. The hook returns `null` for the express Element when it isn’t configured or no express payment methods are eligible. Keep the Payment Element available in that case:

```tsx
import { ScrollView } from 'react-native';
import { ExpressCheckoutElementView } from '@stripe/stripe-react-native/src/components/ExpressCheckoutElementView';
import { CheckoutPaymentElementView } from '@stripe/stripe-react-native/src/components/CheckoutPaymentElementView';

<ScrollView>
  {checkout.expressCheckoutElement && (
    <ExpressCheckoutElementView element={checkout.expressCheckoutElement} />
  )}
  {checkout.paymentElement && (
    <CheckoutPaymentElementView element={checkout.paymentElement} />
  )}
</ScrollView>
```

For custom labels or separators, [observe availability](https://docs.stripe.com/payments/mobile/checkout-sessions/express-checkout-element/accept-a-payment.md?platform=react-native#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=react-native#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=react-native#customize-buttons).

### Handle confirmation results 

The Express Checkout Element confirms the Session and reports `completed`, `canceled`, or `failed` through `expressCheckoutElement.onResult`. Don’t call `checkout.confirm()` for express payments. Keep that call and its separate result handling for your Payment Element **Pay** button, as shown in [Confirm the Session](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#confirm-session).

## 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 `checkout.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.

Add the Shipping Address Element configuration to the object that `getConfiguration` returns in [Configure Checkout](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#configure-checkout):

```tsx
shippingAddressElement: {},
```

Then call `checkout.shippingAddressElement.present()` when the customer taps your shipping address button:

```tsx
import { Button } from 'react-native';

const shippingAddress = checkout.session?.shippingAddress;

<Button
  title={shippingAddress?.address.line1 ?? 'Add shipping address'}
  disabled={checkout.status !== 'ready' || !checkout.shippingAddressElement}
  onPress={() => checkout.shippingAddressElement?.present().catch(showError)}
/>
```

## 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.

Add the Payment Element configuration to the object returned by `getConfiguration` in [Configure Checkout](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#configure-checkout):

```tsx
paymentElement: {},
```

### 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.

Call `checkout.paymentElement.present()` when the customer taps the payment method button. Read the selection from `checkout.session.paymentOption`.

```tsx
import { Button } from 'react-native';

const paymentOption = checkout.session?.paymentOption;
const paymentMethodLabel = paymentOption
  ? [paymentOption.label, paymentOption.sublabel].filter(Boolean).join(' ')
  : 'Select payment method';

<Button
  title={paymentMethodLabel}
  disabled={checkout.status !== 'ready' || !checkout.paymentElement}
  onPress={() => checkout.paymentElement?.present().catch(showError)}
/>
```

### 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.

Render `CheckoutPaymentElementView` in a `ScrollView`. The view resizes to fit its content.

```tsx
import { ScrollView } from 'react-native';
import { CheckoutPaymentElementView } from '@stripe/stripe-react-native/src/components/CheckoutPaymentElementView';

<ScrollView>
  {checkout.paymentElement && (
    <CheckoutPaymentElementView element={checkout.paymentElement} />
  )}
</ScrollView>
```

Some payment methods require mandate text near your **Pay** button. To display it in the embedded view, set `displaysMandateText` to `true` when you configure Checkout:

```tsx
paymentElement: {
  displaysMandateText: true,
},
```

To display the mandate yourself instead, set `displaysMandateText` to `false` and render `checkout.session.paymentOption.mandateHTML` near your **Pay** button.

> #### Mandate compliance
> 
> To comply with mandate requirements, your integration must display the mandate text. If you render it yourself, make sure the links are tappable, and preserve formatting and colors.

```tsx
// Render HTML to preserve formatting and links, for example with react-native-render-html.
import { useWindowDimensions } from 'react-native';
import RenderHtml from 'react-native-render-html';

const { width } = useWindowDimensions();

{checkout.session?.paymentOption?.mandateHTML && (
  <RenderHtml
    contentWidth={width}
    source={{ html: checkout.session.paymentOption.mandateHTML }}
  />
)}
```

## 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 in the object returned by `getConfiguration`.

Apple Pay on iOS, Google Pay on Android, 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:

```tsx
paymentElement: {
  applePay: { display: 'never' },
  googlePay: { display: 'never' },
  link: { display: '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 Checkout is updating, no payment option is selected, or there is other incomplete data (such as shipping address).

Enable **Pay** only when the Session is open and has an email, a payment option, a shipping address if you collect one, and a tax status of `ready`.

```tsx
import { Button } from 'react-native';

const handlePay = async () => {
  try {
    const result = await checkout.confirm();

    switch (result.status) {
      case 'completed':
        // Show an order confirmation. Fulfill from a webhook on your server.
        showOrderConfirmation(result.paymentStatus);
        break;
      case 'canceled':
        // Restore the checkout UI.
        break;
      case 'failed':
        // Display an actionable error and let the customer retry.
        showError(result.error);
        break;
    }
  } catch (error) {
    // Confirmation couldn't start, for example because no screen was available to present from.
    showError(error);
  }
};

// Match shipping_address_collection on your Checkout Session.
const collectsShippingAddress = true;

const { session } = checkout;
const canPay =
  checkout.status === 'ready' &&
  session?.status.type === 'open' &&
  !!session.email &&
  !!session.paymentOption &&
  (!collectsShippingAddress || !!session.shippingAddress) &&
  (session.tax === undefined || session.tax.status === 'ready');

<Button title="Pay" onPress={handlePay} disabled={!canPay} />
```

## 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 `clearCheckoutLocalCustomerData()` as part of your app’s logout logic. This function doesn’t require a loaded Checkout controller.

```tsx
import { clearCheckoutLocalCustomerData } from '@stripe/stripe-react-native/src/functions';

async function handleLogout() {
  await clearCheckoutLocalCustomerData();
  // Other logout logic required by your app.
}
```

