# Enroll Payment Method

This request enrolls a payment method for a customer. With the information provided by WHITELABEL after the customer selects the payment method to enroll, you will be able to save it for future purchases in the payment method object created.

Note that this request requires an `X-Idempotency-Key`. Check the [Authentication](/reference/authentication#idempotency).

<Note>
**Webhooks**

We recommend listening to [Webhooks](/docs/configure-webhooks) to stay up to date with the state of the enrolled payment methods of your customers.
</Note>

In case a customer enrolls the same card twice but with new expiration date or cardholder info, we will unenroll the previously enrolled card and keep the new one.

## Available payment methods for enrollment

The following payment methods can be enrolled using this endpoint:

| Payment Method           | Type                   |
| ------------------------ | ---------------------- |
| **Cards**                | `CARD`                 |
| **Nupay**                | `NU_PAY_ENROLLMENT`    |
| **PayPal**               | `PAYPAL_ENROLLMENT`    |
| **Daviplata**            | `DAVIPLATA_ENROLLMENT` |
| **MercadoPago Wallet**   | `WALLET_CONNECT`       |
| **dLocal Yape**          | `YAPE_ENROLLMENT`      |
| **dLocal Smart PIX**     | `SMART_PIX`            |
| **Astropay**             | `ASTROPAY_ENROLLABLE`  |
| **Adyen PIX Biométrico** | `PIX_BIOMETRICO`       |

<Note>
**Payment Method Availability**

When you retrieve the payment methods available to enroll, only the ones which you have connected, created a route, and added to your checkout will be present. For more information about enrollment workflows, see the [Enroll Payment Methods](/docs/enroll-payment-methods) guide.
</Note>

**POST** `/customers/sessions/{customer_session}/payment-methods`

Base URL: `https://api-sandbox.whitelabel.com/v1`

Enroll Payment Method

## Authorization

- public-api-key (apiKey in header)
- private-secret-key (apiKey in header)
- X-Idempotency-Key (apiKey in header)

## Path parameters

- `customer_session` (string, required)
  The customer session that has been created for the enrollment using the [Create Customer Session](https://docs.whitelabel.com/reference/create-customer-session) endpoint (UUID, 36 chars).

## Body

Content type: `application/json`

- `account_id` (string, required)
  The unique identifier of the account. You find this information on [the WHITELABEL dashboard](https://dashboard.whitelabel.com/) (UUID, 36 chars).
- `payment_method_type` ("CARD" | "MERCADO_PAGO_WALLET" | "NEQUI" | "BANCOLOMBIA_TOKENBOX" | "NU_PAY_ENROLLMENT", required)
  The payment method type (MAX 255; MIN 3; [Payment Type List](/reference/payment-type-list)).
- `country` ("AR" | "BO" | "BR" | "CL" | "CO" | "CR" | "EC" | "SV" | "GT" | "HN" | "MX" | "NI" | "PA" | "PY" | "PE" | "US" | "UY", required)
  The transaction's country code (MAX 2; MIN 2; [ISO 3166-1](/reference/country-reference)).
- `account_updater` (boolean)
  Per-card control for Card Account Updater. When set to `false`, this card is excluded from Card Account Updater and will not receive automatic card-detail updates. When omitted, the card follows your account's Account Updater configuration. Applies at enrollment.
- `verify` (object)
  Indicates whether to verify the payment with a verify transaction or not. You’ll need to have a provider defined in your CARD route. False by default. Access the [Card Verification](/docs/card-verification) page for more details.
  - `vault_on_success` (boolean, required)
    Indicates whether to verify the payment with a verify transaction or not. You’ll need to have a provider defined in your CARD route. False by default.
  - `currency` (string)
    Currency of the card verification. For a full list of currency codes, see [Country reference](/reference/country-reference) (MAX 3; MIN 3; ISO 4217).

Example:

```json
{
  "account_id": "string",
  "payment_method_type": "CARD",
  "country": "AR",
  "account_updater": true,
  "verify": {
    "vault_on_success": true,
    "currency": "string"
  }
}
```

## Responses

### 201

201

- `id` (string)
- `account_id` (string)
- `name` (string)
- `description` (string)
- `type` (string)
- `category` (string)
- `country` (string)
- `status` (string)
- `created_at` (string)
- `updated_at` (string)
- `enrollment` (object)
  - `session` (string)
  - `sdk_required_action` (boolean)
- `provider` (object)
  - `id` (string)
  - `type` (string)
  - `provider_status` (any)
- `customer_payer` (object)
  - `first_name` (string)
  - `last_name` (string)
  - `email` (string)
  - `gender` (string)
  - `date_of_birth` (string)
  - `document` (object)
    - `document_number` (string)
    - `document_type` (string)
  - `phone` (object)
    - `number` (string)
    - `country_code` (string)
  - `billing_address` (object)
    - `address_line_1` (string)
    - `address_line_2` (string)
    - `country` (string)
    - `state` (string)
    - `city` (string)
    - `zip_code` (string)
- `verify` (object)
  - `vault_on_success` (boolean)
  - `payment` (any)
- `preferred` (any)

Example:

```json
{
  "id": "0395199e-a99c-4a85-acac-6c916f43fa74",
  "account_id": "493e9374-510a-4201-9e09-de669d75f256",
  "name": "Visa Credit Card",
  "description": "Visa Credit Card",
  "type": "VISA",
  "category": "CARD",
  "country": "US",
  "status": "READY_TO_ENROLL",
  "created_at": "2024-06-06T13:14:18.799434Z",
  "updated_at": "2024-06-06T13:14:18.799437Z",
  "enrollment": {
    "session": "6641e30d-ca7a-440f-b97c-24231eac6dab",
    "sdk_required_action": false
  },
  "provider": {
    "id": "YUNO",
    "type": "YUNO",
    "provider_status": null
  },
  "customer_payer": {
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe@email.com",
    "gender": "M",
    "date_of_birth": "1990-02-28",
    "document": {
      "document_number": "123456789",
      "document_type": "SSN"
    },
    "phone": {
      "number": "1234567890",
      "country_code": "1"
    },
    "billing_address": {
      "address_line_1": "123 Main St",
      "address_line_2": "Apt 4B",
      "country": "US",
      "state": "NY",
      "city": "New York",
      "zip_code": "10001"
    }
  },
  "verify": {
    "vault_on_success": false,
    "payment": null
  },
  "preferred": null
}
```

### 400

400

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "INVALID_REQUEST",
  "messages": [
    "Invalid request"
  ]
}
```

### 401

401

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "INVALID_CREDENTIALS",
  "messages": [
    "Invalid credentials"
  ]
}
```

### 403

403

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "AUTHORIZATION_REQUIRED",
  "messages": [
    "The merchant has no authorization to use this API."
  ]
}
```