Swipelux

Creating a customer

To create a customer, you'll need to make a POST request to the /v1/customers endpoint. This guide will walk you through the process step by step.

When creating a new customer, please provide as much information as possible to help us verify your users. This will help speed up the KYC process and reduce the likelihood of rejections.

Prepare identifying documents

Before creating a customer, you'll need to prepare their identifying documents. These documents must be converted to base64-encoded Data URIs. Here's how to do it in different programming languages:

function fileToDataURI(file) {
  return new Promise((resolve, reject) => {
    const reader = new FileReader();
    reader.onload = (e) => resolve(e.target.result);
    reader.onerror = (e) => reject('File reading failed');
    reader.readAsDataURL(file);
  });
}
 
// Usage
const fileInput = document.getElementById('file-input');
const file = fileInput.files[0];
fileToDataURI(file).then(dataURI => {
  // Use dataURI in your API request
});

The resulting Data URI should follow this format:

data:[media-type];base64,[base64-encoded-data]

Supported document types include:

  • Driver's license
  • Passport
  • National ID card

Document requirements:

  • Minimum dimensions: 200x200 pixels
  • Supported formats: JPG, PNG, WebP, HEIF

Make the API request

Once you have prepared the documents, you can create a customer by making a POST request to our API:

curl https://wallet.swipelux.com/v1/customers \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: YOUR_SECRET_API_KEY' \
  --data '{
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@example.com",
    "phone": "+1234567890",
    "birthDate": "1990-01-01",
    "residentialAddress": {
      "streetLine1": "123 Main St",
      "city": "San Francisco",
      "state": "CA",
      "postalCode": "94101",
      "country": "US"
    },
    "identifyingInformation": [
      {
        "type": "drivers_license",
        "issuingCountry": "US",
        "frontSideImage": "data:image/png;base64,{...}",
        "backSideImage": "data:image/png;base64,{...}"
      }
    ]
  }'

Make sure to replace YOUR_SECRET_API_KEY with your actual API key and include the base64-encoded document data in both the frontSideImage and backSideImage fields (if applicable). The document images should be encoded as Base64 Data URIs as described in Step 1.

Handle the response

Upon successful creation, you'll receive a response containing the customer's information:

Response body
{
  "id": "cus_cK69MttD5nAUAbud1B",
  "firstName": "John",
  "lastName": "Doe",
  "email": "john.doe@example.com",
  "phone": "+1234567890",
  "status": "approved",
  "metadata": null,
  "createdAt": "2025-04-29T10:13:07.826Z",
  "updatedAt": "2025-04-29T10:13:07.826Z"
}

We will handle all KYC for the customer and return a status field that denotes the KYC status for the customer.

On this page