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

# PrimerPaymentMethodList

> Component that lists the session's payment methods as buttons, and the usePrimerPaymentMethods hook behind it.

> [!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.

`PrimerPaymentMethodList` renders the payment methods available in the current session as a column of buttons and calls `onSelect` when the shopper taps one. It doesn't start a payment: you decide what happens next, usually with [`usePrimerPaymentMethod`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/payment-methods/use-primer-payment-method). To draw the list yourself, use the [`usePrimerPaymentMethods`](#useprimerpaymentmethods) hook the component is built on.

Both need a [`PrimerCheckoutProvider`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/primer-checkout-provider) above them. They don't need `PrimerCheckoutSheet`, which shows its own method list.

## Props

```tsx theme={"dark"}
interface PrimerPaymentMethodListProps {
  data?: PaymentMethodItem[];
  include?: string[];
  exclude?: string[];
  onSelect: (method: PaymentMethodItem) => void;
  onLoad?: (methods: PaymentMethodItem[]) => void;
  style?: ViewStyle;
}
```

| Prop | Type | Default | Description |
| - | - | - | - |
| `onSelect` | `(method: PaymentMethodItem) => void` | Required | Called with the [`PaymentMethodItem`](#paymentmethoditem) the shopper tapped. |
| `data` | `PaymentMethodItem[]` | — | Methods to render instead of loading them. When set, `include`, `exclude` and `onLoad` are ignored and the list never shows its loading state. |
| `include` | `string[]` | — | Show only these payment method types, for example `['PAYMENT_CARD', 'PAYPAL']`. An empty array has no effect. |
| `exclude` | `string[]` | — | Hide these payment method types. Applied after `include`. An empty array has no effect. |
| `onLoad` | `(methods: PaymentMethodItem[]) => void` | — | Called with the filtered methods once they have loaded, and again whenever the set of method types changes. |
| `style` | `ViewStyle` | — | Style of the list's container. |

## Default behavior

* While the checkout initializes and the payment method assets load, the list shows an activity indicator in the theme's `loader` color.
* With no methods to show, it renders an empty view.
* Otherwise it renders one button per method, `spacing.small` apart, styled from the provider's theme. The list doesn't scroll on its own: place it in your own `ScrollView` when it can be taller than the screen.

| Method | Button |
| - | - |
| `PAYMENT_CARD` | Card icon and the SDK's card label on an outlined button. |
| `KLARNA` | Klarna button drawn by the SDK in Klarna's colors. |
| `APPLE_PAY` on iOS | Apple's own Apple Pay button. |
| Google Pay on Android | Google's own Google Pay button. |
| Any other method | The method's logo on its background color, or its name when it has no logo. |

## Usage

Show the list, then the screen for the chosen method:

```tsx theme={"dark"}
import { useState } from 'react';
import type { ReactElement } from 'react';
import { ScrollView } from 'react-native';
import { PrimerPaymentMethodList } from '@primer-io/react-native';

declare function PaymentMethodScreen(props: { type: string; onBack: () => void }): ReactElement;

function PaymentMethodsScreen() {
  const [selectedType, setSelectedType] = useState<string | null>(null);

  if (selectedType) {
    return <PaymentMethodScreen type={selectedType} onBack={() => setSelectedType(null)} />;
  }

  return (
    <ScrollView contentContainerStyle={{ padding: 16 }}>
      <PrimerPaymentMethodList
        include={['PAYMENT_CARD', 'PAYPAL', 'APPLE_PAY', 'GOOGLE_PAY']}
        onSelect={(method) => setSelectedType(method.type)}
      />
    </ScrollView>
  );
}
```

The `declare` line stands for your own `PaymentMethodScreen` component for one method. Build it with [`usePrimerPaymentMethod`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/payment-methods/use-primer-payment-method), which tells you how to drive each method and starts it.

## usePrimerPaymentMethods

`usePrimerPaymentMethods` returns the session's payment methods as [`PaymentMethodItem`](#paymentmethoditem) objects, ready to render. It throws when called outside `PrimerCheckoutProvider`.

```tsx theme={"dark"}
function usePrimerPaymentMethods(options?: UsePrimerPaymentMethodsOptions): UsePrimerPaymentMethodsReturn
```

### Options

| Option | Type | Default | Description |
| - | - | - | - |
| `include` | `string[]` | — | Keep only these payment method types. An empty array has no effect. |
| `exclude` | `string[]` | — | Remove these payment method types. Applied after `include`. An empty array has no effect. |
| `onLoad` | `(methods: PaymentMethodItem[]) => void` | — | Called with the filtered methods once they have loaded, and again whenever the set of method types changes. |

`include` and `exclude` only change what the list shows. They don't change which payment methods the session offers.

### Returns

| Field | Type | Description |
| - | - | - |
| `paymentMethods` | `PaymentMethodItem[]` | The methods left after `include` and `exclude`, in session order. Empty while loading. |
| `isLoading` | `boolean` | `true` until the checkout is ready and the payment method assets (names, logos, colors) have loaded. It turns `true` again for a moment when a client session update changes the set of methods. |
| `error` | `Error \| null` | Set when building the list failed. `paymentMethods` is then empty. |
| `resourcesError` | `Error \| null` | Set when the payment method assets failed to load. The list is still built, with names made from the type (`PAYMENT_CARD` becomes `Payment Card`) and no logos. |
| `selectedMethod` | `PaymentMethodItem \| null` | The method stored with `selectMethod`. It resets to `null` when that method leaves the list. |

| Method | Description |
| - | - |
| `selectMethod(method: PaymentMethodItem \| null)` | Stores a selection in this hook instance, for your own highlight. It doesn't start a payment. |
| `clearSelection()` | Sets `selectedMethod` to `null`. |

### Usage

Build your own rows and hide the methods that can't be used on this device. Each row calls `usePrimerPaymentMethod` for its own method, so it can start a native-UI method (such as Apple Pay or Google Pay) straight from the tap:

```tsx theme={"dark"}
import { ActivityIndicator, Image, Pressable, Text, View } from 'react-native';
import { usePrimerPaymentMethod, usePrimerPaymentMethods } from '@primer-io/react-native';
import type { PaymentMethodItem } from '@primer-io/react-native';

function PaymentMethodRow({ item, onOpen }: { item: PaymentMethodItem; onOpen: (type: string) => void }) {
  const method = usePrimerPaymentMethod(item.type);

  if (!method.isAvailable) {
    return null;
  }

  const onPress = () => {
    if (method.kind === 'nativeUi') {
      method.start().catch(() => {});
    } else {
      onOpen(item.type);
    }
  };

  return (
    <Pressable onPress={onPress} style={{ minHeight: 48, justifyContent: 'center' }}>
      {item.logo ? (
        <Image source={{ uri: item.logo }} style={{ width: 80, height: 24 }} resizeMode="contain" />
      ) : (
        <Text>{item.name}</Text>
      )}
    </Pressable>
  );
}

function PaymentMethods({ onOpen }: { onOpen: (type: string) => void }) {
  const { paymentMethods, isLoading } = usePrimerPaymentMethods();

  if (isLoading) {
    return <ActivityIndicator />;
  }

  return (
    <View style={{ gap: 8 }}>
      {paymentMethods.map((item) => (
        <PaymentMethodRow key={item.type} item={item} onOpen={onOpen} />
      ))}
    </View>
  );
}
```

## PaymentMethodItem

One payment method, ready to render.

| Field | Type | Description |
| - | - | - |
| `type` | `string` | Payment method type, for example `PAYMENT_CARD`, `PAYPAL` or `KLARNA`. Pass it to `usePrimerPaymentMethod`. |
| `name` | `string` | Display name from the payment method's assets, or a name made from the type when there is none. |
| `logo` | `string \| undefined` | Logo image URI. The colored logo when there is one, otherwise the variant for the current light or dark scheme. Render it with `{ uri: logo }`. |
| `backgroundColor` | `string \| undefined` | The method's button color, chosen the same way as `logo`. |
| `nativeViewName` | `string \| undefined` | Name of the native view the SDK uses for this method's button, when it has one. The list uses it to draw the Google Pay button. |
| `categories` | `('NATIVE_UI' \| 'RAW_DATA' \| 'CARD_COMPONENTS' \| 'COMPONENT_WITH_REDIRECT' \| 'KLARNA' \| 'STRIPE_ACH')[]` | The method's manager categories. They decide the method's [kind](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/payment-methods/use-primer-payment-method.md#kinds). |
| `intents` | `('CHECKOUT' \| 'VAULT')[]` | Session intents the method supports. |
| `resource` | `AssetResource \| NativeViewResource \| undefined` | The raw assets the SDK loaded for this method. On an `AssetResource`, `paymentMethodLogo` holds every logo variant (`colored`, `light`, `dark`). |
| `paymentMethod` | `PaymentMethod` | The method as the native SDK reports it: `paymentMethodType`, `paymentMethodManagerCategories` and `supportedPrimerSessionIntents`. |

## See also

> [card] [usePrimerPaymentMethod](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/payment-methods/use-primer-payment-method.md)
>
> Start and drive any payment method by its type.

> [card] [usePrimerVaultManager](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/payment-methods/use-primer-vault-manager.md)
>
> List and pay with the customer's saved payment methods.

> [card] [usePrimerCheckout](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/use-primer-checkout.md)
>
> Checkout state and the payment outcome.

> [card] [PrimerCheckoutSheet](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/primer-checkout-sheet.md)
>
> The prebuilt sheet with its own method list.


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