Xtopay

Customers API

Register, retrieve, list, and update customer profiles to track payments and recurring billing.

Customers API

Customers represent the individuals or companies purchasing your products or subscribing to plans. Creating customer objects allows you to track transactions, invoice recurring fees, manage credit balances, and personalize checkout sessions.


Create a Customer

Register a new customer profile under your business account.

DetailDescription
API Endpointhttps://api.xtopay.co/v1/customers
Request TypePOST
Content Typeapplication/json
AuthenticationBasic Base64(clientId:clientSecret)
Required Scopecustomers:write

Request Parameters

ParameterTypeRequiredDescription
emailStringYesCustomer's email address. Must be unique per business.
nameStringYesCustomer's full name.
phoneStringNoCustomer's phone number in international format (e.g. +233240000000).
externalIdStringNoA unique identifier from your own system to map accounts.
descriptionStringNoInternal notes or description about the customer.
currencyStringNoDefault currency code for invoicing (e.g., "GHS").
metadataObjectNoFlat key-value object containing customer metadata.

Code Examples

curl https://api.xtopay.co/v1/customers \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "yaw@example.com",
    "name": "Yaw Mensah",
    "phone": "+233249998888",
    "externalId": "user_db_yaw123",
    "description": "Enterprise API User",
    "currency": "GHS"
  }'

Sample Response

201 Created

{
  "success": true,
  "data": {
    "id": "cust_cl8z2lh820000a",
    "externalId": "user_db_yaw123",
    "email": "yaw@example.com",
    "name": "Yaw Mensah",
    "phone": "+233249998888",
    "description": "Enterprise API User",
    "metadata": null,
    "status": "ACTIVE",
    "currency": "GHS",
    "createdAt": "2026-06-05T12:00:00Z",
    "updatedAt": "2026-06-05T12:00:00Z"
  }
}

Retrieve a Customer

Get details for a customer profile by their unique Xtopay Customer ID.

DetailDescription
API Endpointhttps://api.xtopay.co/v1/customers/:id
Request TypeGET
AuthenticationBasic Base64(clientId:clientSecret)
Required Scopecustomers:read

Path Parameters

ParameterTypeRequiredDescription
:idStringYesUnique Customer ID (e.g. cust_cl8z2lh820000a).

Code Examples

curl https://api.xtopay.co/v1/customers/cust_cl8z2lh820000a \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET"

Sample Response

200 OK

{
  "success": true,
  "data": {
    "id": "cust_cl8z2lh820000a",
    "externalId": "user_db_yaw123",
    "email": "yaw@example.com",
    "name": "Yaw Mensah",
    "phone": "+233249998888",
    "description": "Enterprise API User",
    "metadata": null,
    "status": "ACTIVE",
    "currency": "GHS",
    "createdAt": "2026-06-05T12:00:00Z",
    "updatedAt": "2026-06-05T12:00:00Z"
  }
}

List Customers

Retrieve customer accounts with optional filters and cursor-based pagination.

DetailDescription
API Endpointhttps://api.xtopay.co/v1/customers
Request TypeGET
AuthenticationBasic Base64(clientId:clientSecret)
Required Scopecustomers:read

Query Parameters

ParameterTypeRequiredDescription
emailStringNoFilter customers whose email contains this substring (case-insensitive).
statusStringNoFilter by customer status: ACTIVE, INACTIVE, BLOCKED.
limitIntegerNoMaximum results to return per page (range 1–100, default 20).
cursorStringNoPagination cursor from the nextCursor value of a previous response.

Code Examples

curl "https://api.xtopay.co/v1/customers?email=yaw&limit=1" \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET"

Sample Response

200 OK

{
  "success": true,
  "data": {
    "items": [
      {
        "id": "cust_cl8z2lh820000a",
        "email": "yaw@example.com",
        "name": "Yaw Mensah",
        "phone": "+233249998888",
        "status": "ACTIVE",
        "createdAt": "2026-06-05T12:00:00Z"
      }
    ],
    "nextCursor": "cust_cl8z2lh820000a",
    "hasMore": false
  }
}

Update a Customer

Modify specific fields on an existing customer record.

DetailDescription
API Endpointhttps://api.xtopay.co/v1/customers/:id
Request TypePATCH
Content Typeapplication/json
AuthenticationBasic Base64(clientId:clientSecret)
Required Scopecustomers:write

Path Parameters

ParameterTypeRequiredDescription
:idStringYesUnique Customer ID to update.

Request Parameters

ParameterTypeRequiredDescription
nameStringNoUpdated customer name.
phoneStringNoUpdated phone number (pass null to clear).
descriptionStringNoUpdated internal notes description (pass null to clear).
statusStringNoSet customer status: ACTIVE, INACTIVE, BLOCKED.
metadataObjectNoUpdated metadata payload. Overwrites current metadata.

Code Examples

curl -X PATCH https://api.xtopay.co/v1/customers/cust_cl8z2lh820000a \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Yaw Mensah Jr.",
    "status": "ACTIVE"
  }'

Sample Response

200 OK

{
  "success": true,
  "data": {
    "id": "cust_cl8z2lh820000a",
    "externalId": "user_db_yaw123",
    "email": "yaw@example.com",
    "name": "Yaw Mensah Jr.",
    "phone": "+233249998888",
    "description": "Enterprise API User",
    "status": "ACTIVE",
    "createdAt": "2026-06-05T12:00:00Z",
    "updatedAt": "2026-06-06T15:00:00Z"
  }
}

How is this guide?

Edit this page on GitHub
Last updated on June 6, 2026

On this page