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. 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 page for more information.

Webhooks

We recommend listening to Webhooks to stay up to date with the state of the enrolled payment methods of your customers.

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.

Only available for PCI certified merchants.

POST/customers/{customer_id}/payment-methods

Path Parameters

customer_idstringrequired

The unique identifier of the customer, created using the Create Customer endpoint (MAX 64; MIN 36).

Body application/json

account_idstringrequired

The unique identifier of the account. You find this information on WHITELABEL’s Dashboard (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).

type"CARD" | "ACH_ENROLLMENT" | "NU_PAY_ENROLLMENT" | "SEPA_ENROLLMENT"required

The payment method type (MAX 255; MIN 3; Payment type).

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_urlstring

URL to return the customer after an enrollment in a provider´s environment. Only necessary for alternative payment methods integrations (MAX 255; MIN 3).

tokenstring<uuid>

Pre-generated token used to reference the payment method being enrolled.

parent_typestring

Type of the parent payment method, used when enrolling a tokenized/derived method (e.g. CARD).

account_updaterboolean

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_dataobject

Specifies the details of the card. Only for DIRECT workflow integration.

Show card_data properties
numberstringrequired

Card’s number without any separators (MAX 19; MIN 8) - only available for PCI certified merchants.

expiration_monthinteger<int32>required

Card’s expiration month - MM (MAX 2; MIN 2) - only available for PCI certified merchants.

expiration_yearinteger<int32>required

Card’s expiration year - YYYY (MAX 4; MIN 4) - only available for PCI certified merchants.

security_codestring

Card’s security code (MAX 4; MIN 3) - only available for PCI certified merchants.

holder_namestring

Cardholder’s full name as it appears on the card (MAX 26; MIN 3) - only available for PCI certified merchants.

brandstring

Card brand (e.g. VISA, MASTERCARD, AMEX).

schemestring

Card scheme used to process the transaction (validated card scheme).

soft_descriptorstring

Statement descriptor shown on the cardholder’s bank statement.

card_pinstring

Card PIN, for payment methods that require it.

authentication_method"FIDO2" | "OWN_CREDENTIALS" | "FEDERATED_ID"

Authentication method for Click-to-Pay.

customer_payerobject

Information about the customer/payer associated with the payment method.

Show customer_payer properties
codestring

WHITELABEL customer identifier (customer code). MIN 3 / MAX 255.

organization_customer_external_idstring

Customer identifier in the merchant’s own system, scoped to the organization. MIN 3 / MAX 255.

emailstring

Email address of the customer.

ip_addressstring

IP address of the customer at the time of enrollment. Required by the provider for the online ACH mandate.

browser_infoobject

Browser metadata. Required by the provider for the online ACH mandate.

Show browser_info properties
user_agentstring

Full user-agent string of the customer’s browser.

payment_methodobject

Payment method wrapper used for non-card methods (e.g. bank transfer / ACH) and vaulting options.

Show payment_method properties
typestring

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_successboolean

When true, the payment method is vaulted (saved) after a successful enrollment.

vault_onlyboolean

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.

detailobject

Method-specific details for the instrument being enrolled.

Show detail properties
bank_transferobject
Show bank_transfer properties
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_idstring

Identifier of the bank. MIN 3 / MAX 255.

bank_namestring

Name of the bank. MIN 3 / MAX 255.

bank_accountstring

Bank account number. MIN 3 / MAX 255.

beneficiary_namestringrequired

Name of the account beneficiary. MIN 3 / MAX 255.

branchstring

Bank branch code. MIN 1 / MAX 8.

branch_digitstring

Branch verification digit. MIN 1 / MAX 2.

routing_numberstringrequired

Bank routing number. MIN 3 / MAX 255.

codestring

Bank code. MIN 1 / MAX 8.

referencestring

Reference associated with the bank account. MIN 1 / MAX 255.

bank_account_mask_numberstring

Masked bank account number associated with the bank transfer (for example, ****6789). This is account data, not mandate data.

mandateobject

Direct debit mandate details, for bank transfer methods that operate with mandates (for example, ACH, SEPA, BACS, PAD).

Show mandate properties
idstring

Mandate identifier, as provided by the payment provider.

infostring

Free-text mandate information.

received_statusstring

Provider status indicating whether the mandate was received. Forwarded as provided by the payment provider.

existing_statusstring

Provider status of the existing mandate. Forwarded as provided by the payment provider.

created_atstring<date-time>

Date and time when the mandate was created (ISO 8601).

updated_atstring<date-time>

Date and time when the mandate was last updated (ISO 8601).

creditor_idstring

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_dataobject

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.

Show provider_data properties
idstringrequired

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_tokenstring

Provider’s payment method token. Required when token_source is PROVIDER_TOKEN.

connection_idstring<uuid>

Identifier of the provider connection. Required when token_source is PROVIDER_API or PROVIDER_TOKEN.

verifyobject

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.

Show verify properties
vault_on_successbooleanrequired

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.

currencystring

Currency of the card verification. For a full list of currency codes, see Country reference (MAX 3; MIN 3; ISO 4217).

external_subscriptionobject

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.

Show external_subscription properties
idstring

Identifier of the subscription in your system.

customer_idstring

Identifier of the subscription’s customer in your system.

metadataobject[]

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.

Show metadata properties
keystringrequired

The metadata key (MAX 48. Value: MIN:1, MAX:48). [Case Sensitive]

valuestringrequired

The metadata key value (MAX 512. Value: MIN:1, MAX:512). [Case Sensitive]

recurring_paymentobject

Recurring / subscription billing metadata associated with the enrolled method.

Show recurring_payment properties
regular_billingobject
Show regular_billing properties
labelstring

Display label for the recurring billing plan.

amountobject
Show amount properties
currencystring

Billing currency, ISO 4217 format (3 letters).

valuenumber

Billing amount per interval. Range 0 – 9999999999.

interval_unit"DAY" | "WEEK" | "MONTH" | "YEAR"

Billing interval unit.

interval_countinteger

Number of interval units between charges (e.g. 1 = every month when interval_unit is MONTH).

Response

201

idempotency_keystring
namestring
descriptionstring
typestring
categorystring
countrystring
statusstring
sub_statusany
vaulted_tokenstring
callback_urlstring
actionstring
redirect_urlstring
parent_typestring
created_atstring
updated_atstring
card_dataobject
Show card_data properties
iinstring
lfdstring
holder_namestring

Cardholder’s full name as returned by the payment provider.

expiration_monthinteger
expiration_yearinteger
number_lengthinteger
security_code_lengthinteger
brandstring
issuerstring
issuer_codeany
country_codestring

ISO 3166-1 alpha-2 country code of the card’s issuing country.

categorystring
typestring
fingerprintstring
last_successfully_usedany
last_successfully_used_atany
preferredany
verifyobject
Show verify properties
vault_on_successboolean
paymentany
provider_dataobject

Additional data from the provider

Show provider_data properties
raw_requestobject

Obfuscated copy of the request WHITELABEL sent to the provider. Only returned for allowlisted organizations.

raw_responseobject

400

codestring
messagesstring[]

401

codestring
messagesstring[]

403

codestring
messagesstring[]
Request
curl -X POST "https://api-sandbox.whitelabel.com/v1/customers/<customer_id>/payment-methods" \
  -H "Content-Type: application/json" \
  -H "public-api-key: <public-api-key>" \
  -H "private-secret-key: <private-secret-key>" \
  -H "X-Idempotency-Key: <X-Idempotency-Key>" \
  -d '{
  "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
    }
  }
}'
Response
{
  "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": {}
  }
}