# 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 that information for future purchases using the payment method object created.

Check the [Available payment methods in WHITELABEL](/reference/payment-type-list). You'll need to set your credentials for each payment method in the WHITELABEL dashboard in order to be able to use them.

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

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

If a customer enrolls the same card multiple times, WHITELABEL creates a new enrollment each time and returns a distinct `vaulted_token`. Use the card `fingerprint` in the enrollment response to detect duplicates on your side (the fingerprint may be `null` for some providers). See [Card Fingerprint](/docs/fingerprint).

<Warning>
**Only available for PCI certified merchants.**
</Warning>

**POST** `/customers/{customer_id}/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_id` (string, required)
  The unique identifier of the customer, created using the [Create Customer](https://docs.whitelabel.com/reference/create-customer) endpoint (MAX 64; MIN 36).

## Body

Content type: `application/json`

- `account_id` (string, required)
  The unique identifier of the account. You find this information on [WHITELABEL's Dashboard](https://dashboard.whitelabel.com/) (MAX 64; MIN 36).
- `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)).
- `type` ("CARD" | "ACH_ENROLLMENT" | "NU_PAY_ENROLLMENT" | "SEPA_ENROLLMENT", required)
  The payment method type (MAX 255; MIN 3; [Payment type](/reference/payment-type-list)).
- `workflow` ("DIRECT")
  The payment workflow indicates whether the integration will use WHITELABEL's SDK or will be a back to back connection. Since you are in the Direct workflow, the value must be `DIRECT`.
- `callback_url` (string)
  URL to return the customer after an enrollment in a provider´s environment. Only necessary for alternative payment methods integrations (MAX 255; MIN 3).
- `token` (string<uuid>)
  Pre-generated token used to reference the payment method being enrolled.
- `parent_type` (string)
  Type of the parent payment method, used when enrolling a tokenized/derived method (e.g. `CARD`).
- `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.
- `card_data` (object)
  Specifies the details of the card. Only for `DIRECT` workflow integration.
  - `number` (string, required)
    Card’s number without any separators (MAX 19; MIN 8) - only available for PCI certified merchants.
  - `expiration_month` (integer<int32>, required)
    Card’s expiration month - MM (MAX 2; MIN 2) - only available for PCI certified merchants.
  - `expiration_year` (integer<int32>, required)
    Card’s expiration year - YYYY  (MAX 4; MIN 4) - only available for PCI certified merchants.
  - `security_code` (string)
    Card’s security code (MAX 4; MIN 3) - only available for PCI certified merchants.
  - `holder_name` (string)
    Cardholder’s full name as it appears on the card (MAX 26; MIN 3) - only available for PCI certified merchants.
  - `brand` (string)
    Card brand (e.g. `VISA`, `MASTERCARD`, `AMEX`).
  - `scheme` (string)
    Card scheme used to process the transaction (validated card scheme).
  - `soft_descriptor` (string)
    Statement descriptor shown on the cardholder’s bank statement.
  - `card_pin` (string)
    Card PIN, for payment methods that require it.
  - `authentication_method` ("FIDO2" | "OWN_CREDENTIALS" | "FEDERATED_ID")
    Authentication method for Click-to-Pay.
- `customer_payer` (object)
  Information about the customer/payer associated with the payment method.
  - `code` (string)
    WHITELABEL customer identifier (customer code). MIN 3 / MAX 255.
  - `organization_customer_external_id` (string)
    Customer identifier in the merchant’s own system, scoped to the organization. MIN 3 / MAX 255.
  - `email` (string)
    Email address of the customer.
  - `ip_address` (string)
    IP address of the customer at the time of enrollment. Required by the provider for the online ACH mandate.
  - `browser_info` (object)
    Browser metadata. Required by the provider for the online ACH mandate.
    - `user_agent` (string)
      Full user-agent string of the customer’s browser.
- `payment_method` (object)
  Payment method wrapper used for non-card methods (e.g. bank transfer / ACH) and vaulting options.
  - `type` (string)
    Method type label for the enrolled instrument (e.g. `ACH_ENROLLMENT`). The enrollment type is driven by the top-level `type`; this field is informational.
  - `vault_on_success` (boolean)
    When `true`, the payment method is vaulted (saved) after a successful enrollment.
  - `vault_only` (boolean)
    When `true`, WHITELABEL stores the bank details from `payment_method.detail.bank_transfer` and enrolls the payment method immediately as `ENROLLED`, without any provider interaction at enrollment or unenrollment. Only available for bank transfer enrollments.
  - `detail` (object)
    Method-specific details for the instrument being enrolled.
    - `bank_transfer` (object)
      - `account_type` ("CHECKINGS" | "SAVINGS")
        Bank account type.
      - `account_holder_type` ("INDIVIDUAL" | "ENTITY")
        Type of account holder (e.g. `INDIVIDUAL`, `ENTITY`). Accepted and stored, but not forwarded to the provider for ACH — does not control individual vs. company treatment for ACH enrollment.
      - `bank_id` (string)
        Identifier of the bank. MIN 3 / MAX 255.
      - `bank_name` (string)
        Name of the bank. MIN 3 / MAX 255.
      - `bank_account` (string)
        Bank account number. MIN 3 / MAX 255.
      - `beneficiary_name` (string, required)
        Name of the account beneficiary. MIN 3 / MAX 255.
      - `branch` (string)
        Bank branch code. MIN 1 / MAX 8.
      - `branch_digit` (string)
        Branch verification digit. MIN 1 / MAX 2.
      - `routing_number` (string, required)
        Bank routing number. MIN 3 / MAX 255.
      - `code` (string)
        Bank code. MIN 1 / MAX 8.
      - `reference` (string)
        Reference associated with the bank account. MIN 1 / MAX 255.
      - `bank_account_mask_number` (string)
        Masked bank account number associated with the bank transfer (for example, ****6789). This is account data, not mandate data.
      - `mandate` (object)
        Direct debit mandate details, for bank transfer methods that operate with mandates (for example, ACH, SEPA, BACS, PAD).
        - `id` (string)
          Mandate identifier, as provided by the payment provider.
        - `info` (string)
          Free-text mandate information.
        - `received_status` (string)
          Provider status indicating whether the mandate was received. Forwarded as provided by the payment provider.
        - `existing_status` (string)
          Provider status of the existing mandate. Forwarded as provided by the payment provider.
        - `created_at` (string<date-time>)
          Date and time when the mandate was created (ISO 8601).
        - `updated_at` (string<date-time>)
          Date and time when the mandate was last updated (ISO 8601).
        - `creditor_id` (string)
          Creditor identifier of the direct debit mandate (for example, the SEPA creditor identifier shown on the payer's bank statement). MIN 1 / MAX 128.
- `provider_data` (object)
  Provider data used for token migration or provider-token enrollment. Send this object when `token_source` is `PROVIDER_API`, `MIGRATION_FILE`, or `PROVIDER_TOKEN`. Usage must be agreed with your commercial advisor in WHITELABEL.
  - `id` (string, required)
    The unique identifier of the payment provider.
  - `token_source` ("PROVIDER_API" | "MIGRATION_FILE" | "PROVIDER_TOKEN")
    Origin of the provided token. Note: `PROVIDER_TOKEN` is only supported when the top-level `type` is `CARD`. Using it with `ACH_ENROLLMENT` returns an error.
  - `payment_method_token` (string)
    Provider’s payment method token. Required when `token_source` is `PROVIDER_TOKEN`.
  - `connection_id` (string<uuid>)
    Identifier of the provider connection. Required when `token_source` is `PROVIDER_API` or `PROVIDER_TOKEN`.
- `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.
  - `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).
  - `external_subscription` (object)
    Links the card verification to a subscription managed in an external billing platform. The object is echoed in the enrollment response and persisted on the verification payment (`verify.payment.id` in the response) — correlate later through Retrieve Payment and payment webhooks; it is not returned by the payment-method retrieve endpoint or enrollment webhooks. Requires `vault_on_success` to be `true`; sending it otherwise returns `INVALID_PARAMETERS`.
    - `id` (string)
      Identifier of the subscription in your system.
    - `customer_id` (string)
      Identifier of the subscription's customer in your system.
  - `metadata` (object[])
    Optional custom key–value tags for the verification (e.g., order_ref, invoice). They are attached to the internal verify payment created by the verification — available downstream exactly like payment `metadata` (payment data, provider gateway request, routing) — and stored with the enrolled payment method's verification settings. Up to 120 items.
    - `key` (string, required)
      The metadata key (MAX 48. Value: MIN:1, MAX:48). **[Case Sensitive]**
    - `value` (string, required)
      The metadata key value (MAX 512. Value: MIN:1, MAX:512). **[Case Sensitive]**
- `recurring_payment` (object)
  Recurring / subscription billing metadata associated with the enrolled method.
  - `regular_billing` (object)
    - `label` (string)
      Display label for the recurring billing plan.
    - `amount` (object)
      - `currency` (string)
        Billing currency, ISO 4217 format (3 letters).
      - `value` (number)
        Billing amount per interval. Range 0 – 9999999999.
    - `interval_unit` ("DAY" | "WEEK" | "MONTH" | "YEAR")
      Billing interval unit.
    - `interval_count` (integer)
      Number of interval units between charges (e.g. `1` = every month when `interval_unit` is `MONTH`).

Example:

```json
{
  "account_id": "string",
  "country": "AR",
  "type": "CARD",
  "workflow": "DIRECT",
  "callback_url": "string",
  "token": "00000000-0000-0000-0000-000000000000",
  "parent_type": "string",
  "account_updater": true,
  "card_data": {
    "number": "string",
    "expiration_month": 0,
    "expiration_year": 0,
    "security_code": "string",
    "holder_name": "string",
    "brand": "string",
    "scheme": "string",
    "soft_descriptor": "string",
    "card_pin": "string",
    "authentication_method": "FIDO2"
  },
  "customer_payer": {
    "code": "string",
    "organization_customer_external_id": "string",
    "email": "string",
    "ip_address": "string",
    "browser_info": {
      "user_agent": "string"
    }
  },
  "payment_method": {
    "type": "string",
    "vault_on_success": true,
    "vault_only": true,
    "detail": {
      "bank_transfer": {
        "account_type": "CHECKINGS",
        "account_holder_type": "INDIVIDUAL",
        "bank_id": "string",
        "bank_name": "string",
        "bank_account": "string",
        "beneficiary_name": "string",
        "branch": "string",
        "branch_digit": "string",
        "routing_number": "string",
        "code": "string",
        "reference": "string",
        "bank_account_mask_number": "string",
        "mandate": {
          "id": "string",
          "info": "string",
          "received_status": "string",
          "existing_status": "string",
          "created_at": "1970-01-01T00:00:00.000Z",
          "updated_at": "1970-01-01T00:00:00.000Z",
          "creditor_id": "string"
        }
      }
    }
  },
  "provider_data": {
    "id": "string",
    "token_source": "PROVIDER_API",
    "payment_method_token": "string",
    "connection_id": "00000000-0000-0000-0000-000000000000"
  },
  "verify": {
    "vault_on_success": true,
    "currency": "string",
    "external_subscription": {
      "id": "string",
      "customer_id": "string"
    },
    "metadata": [
      {
        "key": "string",
        "value": "string"
      }
    ]
  },
  "recurring_payment": {
    "regular_billing": {
      "label": "string",
      "amount": {
        "currency": "string",
        "value": 0
      },
      "interval_unit": "DAY",
      "interval_count": 0
    }
  }
}
```

## Responses

### 201

201

- `idempotency_key` (string)
- `name` (string)
- `description` (string)
- `type` (string)
- `category` (string)
- `country` (string)
- `status` (string)
- `sub_status` (any)
- `vaulted_token` (string)
- `callback_url` (string)
- `action` (string)
- `redirect_url` (string)
- `parent_type` (string)
- `created_at` (string)
- `updated_at` (string)
- `card_data` (object)
  - `iin` (string)
  - `lfd` (string)
  - `holder_name` (string)
    Cardholder's full name as returned by the payment provider.
  - `expiration_month` (integer)
  - `expiration_year` (integer)
  - `number_length` (integer)
  - `security_code_length` (integer)
  - `brand` (string)
  - `issuer` (string)
  - `issuer_code` (any)
  - `country_code` (string)
    ISO 3166-1 alpha-2 country code of the card's issuing country.
  - `category` (string)
  - `type` (string)
  - `fingerprint` (string)
- `last_successfully_used` (any)
- `last_successfully_used_at` (any)
- `preferred` (any)
- `verify` (object)
  - `vault_on_success` (boolean)
  - `payment` (any)
- `provider_data` (object)
  Additional data from the provider
  - `raw_request` (object)
    Obfuscated copy of the request WHITELABEL sent to the provider. Only returned for allowlisted organizations.
  - `raw_response` (object)

Example:

```json
{
  "idempotency_key": "2ca58c6d-8794-4c8f-a2f6-bba4b7498b74",
  "name": "VISA ****1111",
  "description": "VISA ****1111",
  "type": "CARD",
  "category": "CARD",
  "country": "US",
  "status": "ENROLLED",
  "sub_status": null,
  "vaulted_token": "cbdcc878-ceb4-4dd8-b0f0-49d444855de0",
  "callback_url": "www.example.com",
  "action": "string",
  "redirect_url": null,
  "parent_type": "CARD",
  "created_at": "2024-06-06T13:32:49.715656Z",
  "updated_at": "2024-06-06T13:32:49.715656Z",
  "card_data": {
    "iin": "41111111",
    "lfd": "1111",
    "holder_name": "JOHN DOE",
    "expiration_month": 3,
    "expiration_year": 26,
    "number_length": 16,
    "security_code_length": 3,
    "brand": "VISA",
    "issuer": "JPMORGAN CHASE BANK N A",
    "issuer_code": null,
    "country_code": "US",
    "category": "CREDIT",
    "type": "CREDIT",
    "fingerprint": "55a7fe38-cdc3-45dc-8c5f-820751799c76"
  },
  "last_successfully_used": null,
  "last_successfully_used_at": null,
  "preferred": null,
  "verify": {
    "vault_on_success": false,
    "payment": null
  },
  "provider_data": {
    "raw_request": {},
    "raw_response": {}
  }
}
```

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