> ## Documentation Index
> Fetch the complete documentation index at: https://primer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# PrimerSettings

> SDK configuration passed to PrimerCheckoutProvider: payment method options, UI options and event callbacks.

> [!WARNING]
>
> Primer Checkout React Native SDK is currently in **beta** (v3.0.0-beta.1).
> The API is subject to change before the stable release.

`PrimerSettings` is the SDK configuration object. Pass it as the `settings` prop of [`PrimerCheckoutProvider`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/primer-checkout-provider).

## Definition

Import the type with `import type { PrimerSettings } from '@primer-io/react-native'`. The block below shows the shape of the type, not code to copy.

```tsx theme={"dark"}
type PrimerSettings = {
  paymentHandling?: 'AUTO' | 'MANUAL';
  localeData?: { languageCode?: string; localeCode?: string };
  paymentMethodOptions?: PaymentMethodOptions;
  uiOptions?: UIOptions;
  debugOptions?: { is3DSSanityCheckEnabled?: boolean };
  clientSessionCachingEnabled?: boolean;
  apiVersion?: '2.4' | 'latest';
  headlessUniversalCheckoutCallbacks?: HeadlessUniversalCheckoutCallbacks;
};
```

The sections below list the fields of the nested objects. The type of `apiVersion` is exported as `PrimerApiVersion`.

| Key | Type | Default | Description |
| - | - | - | - |
| `paymentHandling` | `'AUTO' \| 'MANUAL'` | `'AUTO'` | Keep the default. `'MANUAL'` is not available with Primer Checkout. |
| `localeData` | `{ languageCode?: string; localeCode?: string }` | — | Passed to the native SDKs, with `localeCode` used as the region code. It does not change the language of the SDK's UI text, which follows the device locale. See [`usePrimerLocalization`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/common/use-primer-localization). |
| `paymentMethodOptions` | `object` | — | Payment method configuration. See [`paymentMethodOptions`](#paymentmethodoptions). |
| `uiOptions` | `object` | — | Appearance mode and the prebuilt sheet's result screens. See [`uiOptions`](#uioptions). |
| `debugOptions` | `{ is3DSSanityCheckEnabled?: boolean }` | `{ is3DSSanityCheckEnabled: true }` | `is3DSSanityCheckEnabled` (default `true`) turns the 3DS sanity checks on or off. Turn them off only during development. |
| `clientSessionCachingEnabled` | `boolean` | `false` | Lets the native SDK cache client session data. |
| `apiVersion` | `'2.4' \| 'latest'` | `'latest'` | Primer API version the native SDK uses. |
| `headlessUniversalCheckoutCallbacks` | `object` | — | Event callbacks. See [`headlessUniversalCheckoutCallbacks`](#headlessuniversalcheckoutcallbacks). |

## Usage

```tsx theme={"dark"}
import { useState } from 'react';
import { PrimerCheckoutProvider, PrimerCheckoutSheet } from '@primer-io/react-native';
import type { PrimerSettings } from '@primer-io/react-native';

const settings: PrimerSettings = {
  paymentMethodOptions: {
    iOS: { urlScheme: 'myapp://primer' },
    applePayOptions: {
      merchantIdentifier: 'merchant.com.myapp',
      isCaptureBillingAddressEnabled: false,
    },
    googlePayOptions: { merchantName: 'My Store' },
  },
  uiOptions: { appearanceMode: 'SYSTEM' },
};

export function Checkout({ clientToken }: { clientToken: string }) {
  const [visible, setVisible] = useState(true);

  return (
    <PrimerCheckoutProvider clientToken={clientToken} settings={settings}>
      <PrimerCheckoutSheet visible={visible} onRequestDismiss={() => setVisible(false)} />
    </PrimerCheckoutProvider>
  );
}
```

> [!WARNING]
>
> `settings` that the native SDK cannot decode make initialization fail, for example an `apiVersion` other than `'2.4'` or `'latest'`. The failure arrives in `usePrimerCheckout().error`. See [`PrimerError`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/common/primer-error).

***

## paymentMethodOptions

```tsx theme={"dark"}
type PaymentMethodOptions = {
  iOS?: { urlScheme?: string };
  android?: { redirectScheme?: string };
  applePayOptions?: ApplePayOptions;
  googlePayOptions?: GooglePayOptions;
  klarnaOptions?: { recurringPaymentDescription?: string; returnIntentUrl?: string };
  threeDsOptions?: {
    iOS?: { threeDsAppRequestorUrl?: string };
    android?: { threeDsAppRequestorUrl?: string };
  };
  stripeOptions?: {
    publishableKey?: string;
    mandateData?: { merchantName: string } | { fullMandateText: string; fullMandateStringResourceName?: string };
  };
};
```

| Key | Type | Description |
| - | - | - |
| `iOS.urlScheme` | `string` | URL your iOS app is opened with when the shopper returns from a redirect or another app, for example `'myapp://primer'`. See [Native setup](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/guides/native-setup.md). |
| `android.redirectScheme` | `string` | Redirect scheme passed to the Android SDK. |
| `applePayOptions` | `object` | Apple Pay configuration, iOS only. See [Apple Pay options](#apple-pay-options). |
| `googlePayOptions` | `object` | Google Pay configuration, Android only. See [Google Pay options](#google-pay-options). |
| `klarnaOptions.returnIntentUrl` | `string` | Android: required for Klarna. The URL Klarna returns to your app with. Without it, selecting a Klarna payment category fails with the error `klarna-return-url-missing`. |
| `threeDsOptions.iOS.threeDsAppRequestorUrl` | `string` | iOS: the URL an out-of-band 3DS challenge uses to return to your app. |
| `threeDsOptions.android.threeDsAppRequestorUrl` | `string` | Android: the URL an out-of-band 3DS challenge uses to return to your app. |
| `stripeOptions.publishableKey` | `string` | Stripe publishable key. Required for Stripe ACH. |
| `stripeOptions.mandateData` | `{ merchantName: string } \| { fullMandateText: string; fullMandateStringResourceName?: string }` | Mandate text the shopper accepts in the Stripe ACH flow. Pass exactly one of `merchantName` or `fullMandateText`. `merchantName` fills the SDK's localized mandate template. `fullMandateText` is shown as is. Required for Stripe ACH: without it, the payment fails at the mandate step with the error `stripe-ach-mandate-config`. |

See [Native setup](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/guides/native-setup.md) for the app-side setup that URL schemes, Apple Pay, Google Pay, Klarna and Stripe ACH need.

### Apple Pay options

`applePayOptions` is read on iOS only.

| Key | Type | Default | Description |
| - | - | - | - |
| `merchantIdentifier` | `string` | Required | Your Apple Pay merchant identifier, for example `'merchant.com.myapp'`. Without it, iOS ignores `applePayOptions`. |
| `merchantName` | `string` | — | Deprecated. Set the merchant name in the [client session](https://primer.io/docs/checkout/client-session.md) instead. |
| `isCaptureBillingAddressEnabled` | `boolean` | Required | Requests the billing postal address when `billingOptions` sets no required billing fields. Prefer `billingOptions` to declare required billing fields. |
| `showApplePayForUnsupportedDevice` | `boolean` | `true` | Passed to the iOS SDK. |
| `checkProvidedNetworks` | `boolean` | `true` | Whether the SDK checks that the device can pay with the provided card networks before presenting Apple Pay. |
| `shippingOptions` | `{ shippingContactFields?: RequiredContactField[]; requireShippingMethod: boolean }` | — | Shipping contact fields to request on the Apple Pay sheet. |
| `billingOptions` | `{ requiredBillingContactFields?: RequiredContactField[] }` | — | Billing contact fields to request on the Apple Pay sheet. |
| `allowedCardTypes` | `('credit' \| 'debit' \| 'prepaid')[]` | — | Card types the Apple Pay sheet offers. Values Apple Pay cannot filter on are ignored. An empty list allows all types. |

`RequiredContactField` is `'name' | 'emailAddress' | 'phoneNumber' | 'postalAddress'`.

### Google Pay options

`googlePayOptions` is read on Android only.

| Key | Type | Default | Description |
| - | - | - | - |
| `merchantName` | `string` | — | Merchant name for the Google Pay sheet. |
| `allowedCardTypes` | `('credit' \| 'debit' \| 'prepaid')[]` | All types | Leave out `'credit'` or `'prepaid'` to block that card type. Debit cards cannot be blocked. An empty list allows all types. |
| `isCaptureBillingAddressEnabled` | `boolean` | `false` | Requests the billing address in the Google Pay sheet. |
| `isExistingPaymentMethodRequired` | `boolean` | `false` | Requires the shopper to have an existing payment method in Google Pay. |
| `requireShippingMethod` | `boolean` | `false` | Passed to the Android SDK. |
| `emailAddressRequired` | `boolean` | `false` | Requests the shopper's email address in the Google Pay sheet. |
| `buttonOptions` | `{ buttonType?: number; buttonTheme?: number }` | — | Google Pay button type and theme, as Google Pay `ButtonConstants` values. |

***

## uiOptions

Primer Checkout reads these keys from `uiOptions`.

| Key | Type | Default | Description |
| - | - | - | - |
| `appearanceMode` | `'SYSTEM' \| 'LIGHT' \| 'DARK'` | `'SYSTEM'` | Color scheme of the Primer Checkout UI. `'LIGHT'` and `'DARK'` force a scheme. Any other value follows the device. Also passed to the native SDKs. See [`PrimerThemeOverride`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/theming/primer-theme-override). |
| `isSuccessScreenEnabled` | `boolean` | `true` | [`PrimerCheckoutSheet`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/primer-checkout-sheet) only. With `false`, the sheet skips its success screen, and its pending screen for Stripe ACH. It clears `paymentOutcome` and calls `onRequestDismiss`. |
| `isErrorScreenEnabled` | `boolean` | `true` | [`PrimerCheckoutSheet`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/primer-checkout-sheet) only. With `false`, the sheet skips its error screen after a failed payment, so the shopper gets no Retry. It clears `paymentOutcome` and calls `onRequestDismiss`. |
| `cardFormUIOptions` | `{ payButtonText?: string }` | — | Card form options of Primer Checkout. `payButtonText` sets the text of the Pay button on the card form of `PrimerCheckoutSheet`. Write `{amount}` where the order total should go. The SDK fills it in, formatted for the shopper and including any card surcharge, and updates it when the surcharge changes. For example, `"Complete order {amount}"` reads "Complete order £11.50". Text without `{amount}` shows no amount, and the SDK leaves the token out while the amount is unknown. Empty or unset keeps "Pay". |

> [!NOTE]
>
> The sheet closes only when your `onRequestDismiss` handler sets `visible` to `false`. When you turn a result screen off, keep the result yourself when it arrives, because the sheet clears `paymentOutcome` before it calls `onRequestDismiss`. To show your own result screens, see [Status screens](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/common/status-screens.md).

***

## headlessUniversalCheckoutCallbacks

Event callbacks from the native SDK. `onCheckoutComplete`, `onError` and `onBeforePaymentCreate` are also props of [`PrimerCheckoutProvider`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/primer-checkout-provider). When you set a callback both as a prop and here, both run, the prop first, with the same arguments.

| Callback | Signature | Description |
| - | - | - |
| `onAvailablePaymentMethodsLoad` | `(paymentMethods: PaymentMethod[]) => void` | The native SDK loaded the session's payment methods. Each item has `paymentMethodType`, `paymentMethodManagerCategories` and `supportedPrimerSessionIntents`. |
| `onClientSessionUpdate` | `(clientSession: ClientSession) => void` | The client session changed. The same value is in `usePrimerCheckout().clientSession`. See [Checkout data](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/common/checkout-data.md#clientsession). |
| `onCheckoutComplete` | `(checkoutData: CheckoutData) => void` | A payment was created. See [Checkout data](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/common/checkout-data.md). |
| `onError` | `(error: PrimerError, checkoutData: CheckoutData \| null) => void` | The native SDK reported an error. See [`PrimerError`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/common/primer-error). |
| `onCheckoutAdditionalInfo` | `(additionalInfo: CheckoutAdditionalInfo) => void` | The native SDK sent additional payment information. Primer Checkout handles the Stripe ACH mandate itself. When this callback is not set, additional info that arrives after the checkout is ready sets `paymentOutcome` to an error with `errorId` `additional-info-unhandled`. |
| `onBeforePaymentCreate` | `(data: CheckoutPaymentMethodData, handler: PaymentCreationHandler) => void` | Runs before the payment is created. Call `handler.continuePaymentCreation()` or `handler.abortPaymentCreation(errorMessage)`. |

`onTokenizationStart`, `onPreparationStart`, `onPaymentMethodShow`, `onBeforeClientSessionUpdate`, `onCheckoutResume` and `onCheckoutPending` are forwarded from the native SDK when you set them.

> [!TIP]
>
> For the payment result, read `usePrimerCheckout().paymentOutcome`. It is set for every payment attempt, with the status `'success'`, `'pending'` or `'error'`. See [Handle the payment result](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/guides/handle-payment-result.md).

## See also

> [card] [PrimerCheckoutProvider](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/primer-checkout-provider.md)
>
> The provider that takes these settings

> [card] [Native setup](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/guides/native-setup.md)
>
> URL schemes, Apple Pay, Google Pay and optional dependencies

> [card] [PrimerError](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/common/primer-error.md)
>
> Errors and where they arrive

> [card] [PrimerThemeOverride](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/theming/primer-theme-override.md)
>
> Theme the checkout and set the appearance mode


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.