Tokenization API

Card Tokenization API Overview

This endpoint is used to tokenize (securely save) a customer's card details for future transactions.
Tokenization allows you to charge the card later without needing to handle sensitive card data again. The
result of a successful tokenization is a token (or identifier) that represents the card in the Facilero platform.

1. Create Token

Endpoint

Live

POST https://live.facilero.com/api/v1/payments/card/tokenize

Sandbox

POST https://sandbox.facilero.com/api/v1/payments/card/tokenize

Request Headers

  • Content-Type: application/json
  • Authorization: Bearer <AUTH_TOKEN>

Request Body DTO

FieldTypeRequiredDescription
requestIdStringYesUnique identifier for this tokenization request.
merchantIdLongYesMerchant ID. The token will be associated with this merchant for billing and ownership tracking.
socialSecurityNumberStringNoCustomer’s SSN for enhanced KYC (nullable).
cardObject (Card)YesCard details to vault. See Card-Sale API’s Card Object (number, expMonth, expYear, cvv).
billingDetailsObject (BillingDetails)YesCustomer billing/KYC info. Mirrors Card-Sale API’s BillingDetails fields.
metadataMap<String, String>NoOptional free-form key/value map for your internal reference.
expirationDateString (YYYY-MM-DD)NoISO-8601 date. Optional token expiry. If omitted, token will expire 5 years from creation.

Example Request Body

{
  "requestId":             "req-token-123",
  "merchantId":            644947533589431519,
  "socialSecurityNumber":  null,
  "card": {
    "number":   "4111111111111111",
    "expMonth": "12",
    "expYear":  "2028",
    "cvv":      "123"
  },
  "billingDetails": {
    "externalUserId": "cust-789",
    "firstName":      "Jane",
    "lastName":       "Doe",
    "address1":       "123 Main St",
    "city":           "Dublin",
    "state":          "Leinster",
    "country":        "IE",
    "postalCode":     "D01X0F5",
    "phone":          "+353851234567",
    "email":          "[email protected]",
    "dateOfBirth":    "1990-05-20"
  },
  "metadata": {
    "customerId":    "cust-789"
  },
  "expirationDate":       "2028-07-14"
}

Response Body DTO

FieldTypeDescription
tokenStringSecure reference for the vaulted card (e.g. tok_abc123xyz).
cardMaskStringMasked PAN for display/logging (e.g. 411111******1111).
expirationMonthStringCard expiration month (MM).
expirationYearStringCard expiration year (YYYY).
cardBrandString (nullable)Card scheme brand (e.g. VISA, MASTERCARD).
cardTypeString (nullable)BIN-derived card type: DEBIT or CREDIT.
issuingBankString (nullable)Name of the issuing bank as returned by BIN lookup.
cardCountryString (nullable)ISO-2 country code of the card’s BIN (e.g. IE).
expirationDateString (YYYY-MM-DD)Date when this token expires (5-year default if not set).
metadataMap<String, String>(nullable) Echo of your free-form metadata map.

Note: Tokenization is a synchronous card-vaulting operation — no 3DS authentication, no callbacks, no redirects. The token is returned immediately in the response. 3DS authentication only applies when charging a saved card.


Example Response Body

{
  "token":            "tok_abc123xyz",
  "cardMask":         "411111******1111",
  "expirationMonth":  "12",
  "expirationYear":   "2028",
  "cardBrand":        "VISA",
  "cardType":         "CREDIT",
  "issuingBank":      "Bank of Dublin",
  "cardCountry":      "IE",
  "expirationDate":   "2028-07-14",
  "metadata":         { "customerId": "cust-789" }
}

See the Card Payments docs for detailed definitions of theCard, BillingDetails, Order, and Device objects.


Sandbox Testing

Test Cards

All test cards tokenize successfully — card behavior only differs at charge time:

Card NumberTokenize BehaviorCharge Behavior
4111111111111111SuccessApproved
5500000000000004SuccessApproved
4000000000003220SuccessCUSTOMER_VERIFICATION + mock 3DS challengeUrl
4000000000000002SuccessFAILED with decline code

Token Expiration

  • Default TTL: 90 days (configurable per environment). If expirationDate is provided, the shorter of default and requested TTL is used
  • Expired or inactive tokens return a decline on charge attempts

Next Steps