Skip to content

Customers

Overview

A Customer is a reusable entity that groups a payer’s saved payment methods, payment history, and payment plans under a single identifier. Attaching customers to payment intents lets you:

  • Charge saved payment methods without the customer present
  • Link transactions to a payer for reporting and reconciliation
  • Set up recurring payment plans via the API

All customer operations require a secret key (sk_xxx).

Create a customer

Terminal window
curl -X POST https://api.elasticpay.co/api/v1/customers \
-H "Authorization: Bearer sk_sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Alice Smith",
"email": "alice@example.com",
"reference": "alice-user-42"
}'

Response

{
"id": "cus_0abc123def456ghi789jkl012mno",
"name": "Alice Smith",
"email": "alice@example.com",
"reference": "alice-user-42",
"created_at": "2026-04-01T10:00:00Z",
"updated_at": "2026-04-01T10:00:00Z"
}

The id (e.g. cus_0abc...) is the customer’s stable identifier to use in subsequent requests.

The reference field is a freeform string you can use to correlate the customer with a record in your own system.

Fetch a customer

Terminal window
curl https://api.elasticpay.co/api/v1/customers/cus_0abc123def456ghi789jkl012mno \
-H "Authorization: Bearer sk_sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

List customers

Terminal window
curl "https://api.elasticpay.co/api/v1/customers?limit=20" \
-H "Authorization: Bearer sk_sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Response shape

{
"data": [],
"has_more": false
}

Supported query parameters:

ParameterDescription
limitNumber of results per page (default 20, max 100)
starting_afterCursor: return results after this customer ID
emailFilter by email (exact match)
referenceFilter by your external reference

Update a customer

Use PUT to update any mutable field. Fields not included in the request body are left unchanged.

Terminal window
curl -X PUT https://api.elasticpay.co/api/v1/customers/cus_0abc123def456ghi789jkl012mno \
-H "Authorization: Bearer sk_sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"email": "new-email@example.com"}'

Delete a customer

Deleting a customer performs a soft-delete — the record is hidden from API responses and the portal but retained in the database for audit purposes. Payment intents and transactions associated with the customer are preserved.

Terminal window
curl -X DELETE https://api.elasticpay.co/api/v1/customers/cus_0abc123def456ghi789jkl012mno \
-H "Authorization: Bearer sk_sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

A successful deletion returns 204 No Content.

List a customer’s payment methods

Retrieve all saved payment methods (pm_xxx) for a customer:

Terminal window
curl https://api.elasticpay.co/api/v1/customers/cus_0abc123def456ghi789jkl012mno/payment_methods \
-H "Authorization: Bearer sk_sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Attach a customer to a payment intent

Pass customer_id when creating a payment intent to associate it with a customer:

Terminal window
curl -X POST https://api.elasticpay.co/api/v1/payment_intents \
-H "Authorization: Bearer sk_sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"amount": 4900,
"currency": "AUD",
"customer_id": "cus_0abc123def456ghi789jkl012mno"
}'

Required permissions

OperationRequired scope
Create / update / deletecustomers:write
Fetch / listcustomers:read

Secret keys (sk_xxx) have both scopes by default.