# Let customers pay in their local currency

Add Adaptive Pricing and the Currency Selector Element to mobile checkout.

Use [Adaptive Pricing](https://docs.stripe.com/payments/currencies/localize-prices/adaptive-pricing.md) with the [Currency Selector Element](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md#currency-selector) to let eligible customers choose between your integration currency and a localized currency. Stripe localizes prices, provides the required exchange rate disclosure, updates available payment methods, and handles currency conversion.

### 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/adaptive-pricing" \
  -d '{"email": "EMAIL", "preview": "elements_beta_preview"}'
```
![Checkout with a Currency Selector Element showing 70.23 in GBP and 90.00 in USD, with USD selected and the exchange rate disclosed below.](https://b.stripecdn.com/docs-statics-srv/assets/adaptive-pricing-currency-selector.19ec542d986ec866e58a447febca94fa.png)

The preview supports one-time payments only. Adaptive Pricing requires Checkout Sessions and isn’t supported with the Payment Intents API.

# Android


## Before you begin

Before you add Adaptive Pricing, complete these tasks:

- [Build a mobile checkout with Checkout Sessions](https://docs.stripe.com/payments/mobile/checkout-sessions/build-a-checkout-page.md).
- Review the Adaptive Pricing [supported regions, currencies, and restrictions](https://docs.stripe.com/payments/currencies/localize-prices/adaptive-pricing.md?payment-ui=embedded-components#restrictions).

When Adaptive Pricing is active, the client-side Session includes localized line items and totals. When a customer selects a currency in the Currency Selector Element, it updates the shared Session, available payment methods, and other Session-backed Elements. The server-side [Checkout Session](https://docs.stripe.com/api/checkout/sessions/object.md) remains denominated in your integration currency and exposes the customer’s presentment context separately.

## Enable Adaptive Pricing on the Checkout Session [Server-side]

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` when you create the Checkout Session on your server. Use an integration currency that’s one of your [settlement currencies](https://docs.stripe.com/payouts/multi-currency-settlement.md).

```curl
curl https://api.stripe.com/v1/checkout/sessions \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d ui_mode=mobile_elements \
  -d "adaptive_pricing[enabled]=true" \
  -d "items[0][type]=one_time_price" \
  -d "items[0][one_time_price][items][0][price]={{PRICE_ID}}" \
  -d "items[0][one_time_price][items][0][quantity]=1"
```

## Configure Adaptive Pricing [Client-side]

When you configure the Currency Selector Element, you must also [render it](https://docs.stripe.com/payments/mobile/checkout-sessions/adaptive-pricing.md#add-currency-selector) and [display localized prices](https://docs.stripe.com/payments/mobile/checkout-sessions/adaptive-pricing.md#render-localized-prices) throughout your checkout.

Configure the Currency Selector Element on your `CheckoutElementsController` to enable Adaptive Pricing on the client.

Create the controller in a `ViewModel` and use its `SavedStateHandle` to preserve checkout state across configuration changes and process recreation. From your UI, call the `ViewModel`’s `configure` method to configure checkout in `viewModelScope`.

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

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

fun configure(clientSecret: String) {
    viewModelScope.launch {
        val currencyAppearance = CurrencySelectorElement.Configuration.Appearance()
            .cornerRadiusDp(12f)
            .labelContent(
                CurrencySelectorElement.Configuration.Appearance.LabelContent.AMOUNT
            )

        val configuration = CheckoutElementsController.Configuration()
            .paymentElement(PaymentElement.Configuration())
            .currencySelectorElement(
                CurrencySelectorElement.Configuration()
                    .appearance(currencyAppearance)
            )

        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 the Checkout Session.

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

Place the Currency Selector Element near your order total. It displays only when Adaptive Pricing is available, and updates the Checkout Session when the customer selects a currency.

Create one presenter for the Activity and retain the Element instances it returns.

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

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

## Render localized prices [Client-side]

Render every amount in your checkout from the latest `CheckoutElementsController.session`, including line items, discounts, tax, shipping, and totals.

Collect the Session so your UI updates after a currency change.

```kotlin
@Composable
fun CheckoutScreen(controller: CheckoutElementsController) {
    val session by controller.session.collectAsState()

    session?.let { currentSession ->
        Text("Total ${currentSession.totals.total.amount}")
    }
}
```

## Testing

To test local currency presentment, pass a location-formatted customer email that includes a `+location_XX` suffix in the local part of the email. `XX` must be a valid [two-letter ISO country code](https://www.nationsonline.org/oneworld/country_code_list.htm).

For example, to test currency presentment for a customer in France, set [customer_email](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-customer_email) to `test+location_FR@example.com` when you create the Checkout Session. Your app displays the currency that a customer in France would see.

```curl
curl https://api.stripe.com/v1/checkout/sessions \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d ui_mode=mobile_elements \
  --data-urlencode "customer_email=test+location_FR@example.com" \
  -d "adaptive_pricing[enabled]=true" \
  -d "items[0][type]=one_time_price" \
  -d "items[0][one_time_price][items][0][price]={{PRICE_ID}}" \
  -d "items[0][one_time_price][items][0][quantity]=1"
```

Stripe test cards work as usual.

