/api/v1/businesses/:id/customersx-api-keySandbox + liveCreate customer
Create a reusable customer identity with permanent deposit addresses.
When to use it
Use before recurring invoicing or when you want to track invoices by a stable customer record.
Idempotency: recommended
| Field | Location | Required | Description | Example / default |
|---|---|---|---|---|
| id | path | Yes | Business ID. | - |
| externalRef | body | Yes | Your internal customer identifier. | - |
| body | No | Optional customer email. | - |
Cautions
- For one-off anonymous payments, create invoices without a customerId instead of creating throwaway customers.
- Address provisioning depends on the business wallet being ready in the selected environment.
Common errors
- 401: Missing or invalid API key.
- 400: Payload shape, query params, or business-state validation failed.
Sample request body
json{
"externalRef": "customer_001",
"email": "customer@example.com"
}Sample response
json{
"id": "cus_123",
"externalRef": "customer_001",
"email": "customer@example.com",
"addresses": [
{ "chainFamily": "eth", "address": "0xE5fa2F71065fD49823D33EdD84ecFD2D6245c916" },
{ "chainFamily": "sol", "address": "8gRLe6GiQx2jo9mQFcbwy34u2W4zD2rN5q4mmD8iP2Mp" }
]
}cURL example
bashcurl -X POST "https://api.paychainhq.io/api/v1/businesses/biz_123/customers" \
-H "Content-Type: application/json" \
-H "x-api-key: pk_live_your_business_key" \
-H "Idempotency-Key: example-request-001" \
-d '{
"externalRef": "customer_001",
"email": "customer@example.com"
}'Node.js example
tsconst response = await fetch('https://api.paychainhq.io/api/v1/businesses/biz_123/customers', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'pk_live_your_business_key',
'Idempotency-Key': 'example-request-001',
},
body: JSON.stringify({
"externalRef": "customer_001",
"email": "customer@example.com"
}),
});
const payload = await response.json();
console.log(payload);