CustomersBeta

A Customer ties a person to your saved cards, payment history, and billing defaults. Create one at signup or at first checkout, then attach PaymentMethods and reuse them for off-session charges.

Customers carry B2B fields (is_company, tax_id), and invoice settings — including the default PM and Mandate to use for recurring billing. email and name are required at create. Billing address and default currency are read-only over the API — they appear in the object but are not settable via Create or Update; they stay nullfor API-minted customers.

The Customer objectBeta

idstring
Unique identifier, prefixed cus_.
objectstring
Always "customer".
emailstring|null
Customer email.
namestring|null
Full name.
first_namestring|null
First name, when captured separately from name. Read-only over the API — not settable via Create or Update, so it is always null for API-minted customers.
last_namestring|null
Last name, when captured separately from name. Read-only over the API — not settable via Create or Update, so it is always null for API-minted customers.
phonestring|null
E.164 phone number.
descriptionstring|null
Free-form, your reference.
default_payment_methodstring|null
ID of the default PaymentMethod for off-session charges. Mirrors invoice_settings.default_payment_method. Deprecated — prefer invoice_settings.default_payment_method.
currencystring|null
ISO 4217. The currency for this customer's billing defaults — does not constrain the currencies of individual PaymentIntents. Read-only over the API — not settable via Create or Update, so it is always null for API-minted customers.
addressobject|null
Billing address. line1, line2, city, state, postal_code, country. Read-only over the API — not settable via Create or Update, so it is always null for API-minted customers.
invoice_settingsobject|null
default_payment_method (preferred PM for recurring charges), default_mandate (its companion Mandate id), and footer (text shown on rendered invoices).
default_mandatestring|null
ID of the default Mandate for off-session charges. Mirrors invoice_settings.default_mandate.
is_companyboolean|null
Whether this customer is a business. Affects receipt copy, VAT/invoice handling, and corporate-card SCA exemption eligibility.
tax_idstring|null
Country-specific tax identifier (VAT, EIN, ABN, …). Free-form, not validated server-side.
sourcestring|null
Provenance — which surface minted this customer: api, merchant_dashboard, checkout_session, or staff. Server-controlled and immutable.
source_idstring|null
Parent resource id for source — the cs_ id for checkout-minted customers. Null otherwise.
metadataobject
Key-value pairs.
deletedboolean
True after a DELETE; the customer record persists as a tombstone.
deleted_atstring|null
ISO-8601 timestamp of deletion, or null.
livemodeboolean
Test or live.
created_atstring
ISO-8601.
THE CUSTOMER OBJECT
JSON
1{
2 "id": "cus_01JQX...",
3 "object": "customer",
4 "email": "avery@example.com",
5 "name": "Avery Lin",
6 "first_name": null,
7 "last_name": null,
8 "phone": "+5999000000",
9 "description": "Wholesale account",
10 "default_payment_method": null,
11 "currency": null,
12 "address": null,
13 "invoice_settings": {
14 "default_payment_method": "pm_01JQX...",
15 "default_mandate": "mdt_01JQX...",
16 "footer": "Thanks for your business."
17 },
18 "default_mandate": "mdt_01JQX...",
19 "is_company": false,
20 "tax_id": null,
21 "source": "api",
22 "source_id": null,
23 "metadata": { "tier": "gold" },
24 "deleted": false,
25 "deleted_at": null,
26 "livemode": false,
27 "created_at": "2026-04-07T18:30:00.000Z"
28}

Was this section helpful?

Create a customerBeta

POST/v1/customers

Body parameters

emailstringRequired
Customer email. Required — the card networks require it on every authorization.
namestringRequired
Full name. Required, non-empty.
phonestring
E.164.
descriptionstring
Free-form, your reference.
is_companyboolean
Mark the customer as a business (B2B).
tax_idstring
Country-specific tax identifier (VAT, EIN, …).
metadataobject
Key-value pairs.

Headers

All HMAC headers + Idempotency-Key (UUID v4, required).

REQUEST
1curl -X POST https://api.cxpay.net/v1/customers \
2 -H "X-Key-Id: ak_test_..." \
3 -H "Content-Type: application/json" \
4 -H "Idempotency-Key: 550e8400-..." \
5 -H "X-Signature: <base64-hmac>" \
6 -H "X-Timestamp: 2026-04-07T18:30:00.000Z" \
7 -H "X-Nonce: 550e8400-..." \
8 -H "X-Body-Hash: <sha256-of-body>" \
9 -d '{
10 "email": "avery@example.com",
11 "name": "Avery Lin",
12 "is_company": false
13 }'
TestPOST /v1/customers
RESPONSE
JSON
1{
2 "data": {
3 "id": "cus_01JQX...",
4 "object": "customer",
5 "email": "avery@example.com",
6 "name": "Avery Lin",
7 "first_name": null,
8 "last_name": null,
9 "phone": "+5999000000",
10 "description": "Wholesale account",
11 "default_payment_method": null,
12 "currency": null,
13 "address": null,
14 "invoice_settings": {
15 "default_payment_method": "pm_01JQX...",
16 "default_mandate": "mdt_01JQX...",
17 "footer": "Thanks for your business."
18 },
19 "default_mandate": "mdt_01JQX...",
20 "is_company": false,
21 "tax_id": null,
22 "source": "api",
23 "source_id": null,
24 "metadata": { "tier": "gold" },
25 "deleted": false,
26 "deleted_at": null,
27 "livemode": false,
28 "created_at": "2026-04-07T18:30:00.000Z"
29 }
30}

Was this section helpful?

Retrieve a customerBeta

GET/v1/customers/:id

Returns one customer by id.

Path parameters

idstringRequired
The customer id.
RESPONSE
JSON
1{
2 "data": {
3 "id": "cus_01JQX...",
4 "object": "customer",
5 "email": "avery@example.com",
6 "name": "Avery Lin",
7 "first_name": null,
8 "last_name": null,
9 "phone": "+5999000000",
10 "description": "Wholesale account",
11 "default_payment_method": null,
12 "currency": null,
13 "address": null,
14 "invoice_settings": {
15 "default_payment_method": "pm_01JQX...",
16 "default_mandate": "mdt_01JQX...",
17 "footer": "Thanks for your business."
18 },
19 "default_mandate": "mdt_01JQX...",
20 "is_company": false,
21 "tax_id": null,
22 "source": "api",
23 "source_id": null,
24 "metadata": { "tier": "gold" },
25 "deleted": false,
26 "deleted_at": null,
27 "livemode": false,
28 "created_at": "2026-04-07T18:30:00.000Z"
29 }
30}

Was this section helpful?

Update a customerBeta

PATCH/v1/customers/:id

Accepts email, name, phone, description, is_company, tax_id, metadata, and default_payment_method. Most common operation: setting the flat default_payment_method after vaulting a card. On read it surfaces on the top-level default_payment_method response field.

REQUEST
1curl -X PATCH https://api.cxpay.net/v1/customers/cus_01JQX... \
2 -H "X-Key-Id: ak_test_..." \
3 -H "Content-Type: application/json" \
4 -H "X-Signature: <base64-hmac>" \
5 -H "X-Timestamp: 2026-04-07T18:30:00.000Z" \
6 -H "X-Nonce: 550e8400-..." \
7 -H "X-Body-Hash: <sha256-of-body>" \
8 -d '{
9 "default_payment_method": "pm_01JQX..."
10 }'
TestPATCH /v1/customers/cus_01JQX...
RESPONSE
JSON
1{
2 "data": {
3 "id": "cus_01JQX...",
4 "object": "customer",
5 "email": "avery@example.com",
6 "name": "Avery Lin",
7 "first_name": null,
8 "last_name": null,
9 "phone": "+5999000000",
10 "description": "Wholesale account",
11 "default_payment_method": null,
12 "currency": null,
13 "address": null,
14 "invoice_settings": {
15 "default_payment_method": "pm_01JQX...",
16 "default_mandate": "mdt_01JQX...",
17 "footer": "Thanks for your business."
18 },
19 "default_mandate": "mdt_01JQX...",
20 "is_company": false,
21 "tax_id": null,
22 "source": "api",
23 "source_id": null,
24 "metadata": { "tier": "gold" },
25 "deleted": false,
26 "deleted_at": null,
27 "livemode": false,
28 "created_at": "2026-04-07T18:30:00.000Z"
29 }
30}

Was this section helpful?

List customersBeta

GET/v1/customers

Returns a page of customers for your MerchantOrg, newest first. Results are wrapped in a list envelope — data holds the customer objects, and has_more / next_cursor drive pagination.

Query parameters

limitinteger
Page size. Defaults to 10, capped at 100.
cursorstring
Opaque pagination cursor. Pass the next_cursor from the previous page to fetch the next one.
emailstring
Filter to customers with this exact email.

Response

dataarray
The page of customer objects.
has_moreboolean
Whether another page is available.
next_cursorstring|null
Cursor for the next page, or null when has_more is false.
REQUEST
1curl https://api.cxpay.net/v1/customers?limit=10 \
2 -H "X-Key-Id: ak_test_..." \
3 -H "X-Signature: <base64-hmac>" \
4 -H "X-Timestamp: 2026-04-07T18:30:00.000Z" \
5 -H "X-Nonce: 550e8400-..." \
6 -H "X-Body-Hash: <sha256-of-empty-body>"
TestGET /v1/customers?limit=10
RESPONSE
JSON
1{
2 "data": [
3 {
4 "id": "cus_01JQX...",
5 "object": "customer",
6 "email": "avery@example.com",
7 "name": "Avery Lin",
8 "first_name": null,
9 "last_name": null,
10 "phone": "+5999000000",
11 "description": "Wholesale account",
12 "default_payment_method": null,
13 "currency": null,
14 "address": null,
15 "invoice_settings": {
16 "default_payment_method": "pm_01JQX...",
17 "default_mandate": "mdt_01JQX...",
18 "footer": "Thanks for your business."
19 },
20 "default_mandate": "mdt_01JQX...",
21 "is_company": false,
22 "tax_id": null,
23 "source": "api",
24 "source_id": null,
25 "metadata": { "tier": "gold" },
26 "deleted": false,
27 "deleted_at": null,
28 "livemode": false,
29 "created_at": "2026-04-07T18:30:00.000Z"
30 }
31 ],
32 "has_more": false,
33 "next_cursor": null
34}

Was this section helpful?

Delete a customerBeta

DELETE/v1/customers/:id

Marks the customer deleted and returns the customer object with deleted set to true and deleted_at set to the deletion timestamp. Deleting cascades — attached PaymentMethods are detached and Mandates revoked in the background. The call is idempotent: deleting an already-deleted customer returns the existing tombstone.

Deletion is not a PII redaction. Identifying fields such as email and name are retained on the tombstone. GDPR/PII scrubbing is a separate operation.

Path parameters

idstringRequired
The customer id.
REQUEST
1curl -X DELETE https://api.cxpay.net/v1/customers/cus_01JQX... \
2 -H "X-Key-Id: ak_test_..." \
3 -H "X-Signature: <base64-hmac>" \
4 -H "X-Timestamp: 2026-04-07T18:30:00.000Z" \
5 -H "X-Nonce: 550e8400-..." \
6 -H "X-Body-Hash: <sha256-of-empty-body>"
TestDELETE /v1/customers/cus_01JQX...
RESPONSE
JSON
1{
2 "data": {
3 "id": "cus_01JQX...",
4 "object": "customer",
5 "email": "avery@example.com",
6 "name": "Avery Lin",
7 "first_name": null,
8 "last_name": null,
9 "phone": "+5999000000",
10 "description": "Wholesale account",
11 "default_payment_method": null,
12 "currency": null,
13 "address": null,
14 "invoice_settings": null,
15 "default_mandate": null,
16 "is_company": false,
17 "tax_id": null,
18 "source": "api",
19 "source_id": null,
20 "metadata": { "tier": "gold" },
21 "deleted": true,
22 "deleted_at": "2026-04-08T09:15:00.000Z",
23 "livemode": false,
24 "created_at": "2026-04-07T18:30:00.000Z"
25 }
26}

Was this section helpful?

Powered by CX Pay