{"object":"doc","slug":"customers","title":"Customers","summary":"Create, read, change and delete the customers of a merchant, the owners of saved cards; the fields, the Stripe id link, what a delete refuses and what it erases, and the customer events.","tags":["guide","customers","billing","stripe"],"body":"# Customers\n\nA customer (`cus_...`) is a person a merchant sells to: the owner of saved cards, and the buyer on subscriptions and checkouts. It belongs to one merchant, and through it to one platform and one mode. It is a ZeroPoint record only. It is never sent to the processor and holds no card data.\n\nScopes: `customers:read` for reads, `customers:write` for creates, changes and deletes.\n\n## The object\n\n```json\n{\n  \"object\": \"customer\",\n  \"id\": \"cus_01j...\",\n  \"created\": 1794790000,\n  \"updated\": 1794790000,\n  \"livemode\": false,\n  \"merchant_id\": \"mch_01j...\",\n  \"email\": \"pat@example.com\",\n  \"name\": \"Pat Lee\",\n  \"phone\": \"+1 504 555 0100\",\n  \"description\": \"Front desk regular\",\n  \"metadata\": {\"member_id\": \"42\"},\n  \"stripe_id\": null,\n  \"test_clock\": null\n}\n```\n\n| Field | Rule |\n|---|---|\n| `email` | Optional, up to 254 characters with one @. Not unique: two customers may share one. |\n| `name` | Optional, 1 to 250 characters. |\n| `phone` | Optional, up to 32 characters of digits and `+ - ( )` and space. |\n| `description` | Optional internal note, 1 to 500 characters. |\n| `metadata` | Up to 50 string pairs. Put your own customer id here. |\n| `stripe_id` | Optional, the Stripe customer id this customer came from. Set once. |\n| `test_clock` | Test mode only, optional on create: the test clock (`clock_...`) whose time this customer's subscriptions run on ([Test your billing with test clocks](test-billing-with-test-clocks.md)). The customer shows it; `null` when none. Set at create, never changed. |\n\nNo free-text field may hold a card number. There is no address, tax id, balance or default card in this version.\n\n## Create\n\n```\nPOST /v1/customers\nIdempotency-Key: signup-42\n{\"merchant_id\":\"mch_...\",\"email\":\"pat@example.com\",\"name\":\"Pat Lee\",\"phone\":\"+1 504 555 0100\",\"metadata\":{\"member_id\":\"42\"}}\n```\n\nThe answer is the customer, and `customer.created` is sent. Call `GET /v1/customers` with `email=pat@example.com` first and reuse a customer that exists. The `email` filter is exact and case-sensitive, as Stripe's: `email=pat@example.com` does not find a customer saved as `Pat@Example.com`. ZeroPoint keeps the email as you sent it (spaces at either end removed). So that one person never becomes two customers, put every email in one form in your app (trimmed and lower case is the usual choice) before you create a customer or search for one, and search with that same form.\n\n## Change\n\n`PATCH /v1/customers/{customer_id}` changes only the fields you send. `null` clears `email`, `name`, `phone` or `description`. `metadata` merges key by key, as on Stripe: a key sent as `\"\"` is removed, `\"metadata\": \"\"` removes every key, and `{}` changes nothing. `POST /v1/customers/{customer_id}` does the same as `PATCH`. A change sends `customer.updated`; a `PATCH` that changes nothing sends no event.\n\n## Link a customer to its Stripe id\n\n`stripe_id` is set once: on create, or by `PATCH` while it is null. That lets you link a customer made before a migration instead of making a second one. It is unique per merchant. A create or `PATCH` that repeats one answers `409 stripe_id_in_use` and names the customer that holds it, and says so when that customer was deleted: do not recreate it. A different `stripe_id` on a customer that has one answers `400 parameter_immutable`; the same one again changes nothing. `GET /v1/customers` with `stripe_id=cus_Stripe9` finds it.\n\n## Read and list\n\n`GET /v1/customers/{customer_id}` reads one. `GET /v1/customers` lists newest first, with filters `merchant_id`, `email` (exact, case-sensitive), `stripe_id` and `include_deleted` (default false), plus `limit` and `cursor`.\n\nA deleted customer reads as `{\"object\": \"customer\", \"id\": \"cus_...\", \"deleted\": true}`, so you can tell a deleted customer from a wrong id (`404 resource_missing`). A `PATCH` of a deleted customer answers `404 resource_missing` and changes nothing, and no card can be saved for it.\n\n## Delete\n\n`DELETE /v1/customers/{customer_id}` either completes or changes nothing. First it refuses while money still depends on the customer:\n\n| Refusal | When | What to do |\n|---|---|---|\n| `409 checkout_session_busy`, `Retry-After: 30` | A checkout for this customer is being paid right now | Retry after the wait |\n| `409 customer_has_subscriptions` | A subscription of this customer is not canceled; the message names it | Cancel the subscription, then delete |\n| `409 payment_method_in_use` | A saved card of this customer is still needed. This is the same check as `DELETE /v1/payment_methods/{payment_method_id}`. With `Retry-After: 30` a payment using it has not finished. With `Retry-After: 60` a payment using it has a processor answer still being recorded, or the check could not be run. Without `Retry-After`, the message says what holds the card. | Retry after the wait; without one, remove that use first |\n\nThen, in one change: every saved card of the customer is deleted (the card's token is erased here and `payment_method.detached` is sent for each; the processor has no token delete, so nothing is sent to it), the customer is marked deleted, and `customer.deleted` is sent after them. If any step fails, nothing changes: no token is erased and the customer stays. The answer is `{\"object\": \"customer\", \"id\": \"cus_...\", \"deleted\": true}`. A second delete gives the same answer and sends nothing.\n\nThe deleted customer's record is kept, because past payments and subscriptions name it. Its name, email, phone and description stay on it.\n\nA code with `once_per_customer` counts uses by email when one is known, so deleting a customer and making a new one with the same email does not give a second use (`catalog` has the details).\n\n## Events\n\n`customer.created`, `customer.updated` and `customer.deleted` are billing events: subscribe to them by type (`billing-webhooks`). `customer.updated` carries `previous_attributes` with the old values of what changed.\n\n## MCP tools\n\n`create_customer` (all the fields above, `merchant_id` required), `get_customer`, `list_customers` and `update_customer` (the same as `PATCH`; `clear` lists fields to set to null). Each calls the same service as its route. Calling `create_customer` again with the same arguments within 24 hours returns the first customer. There is no delete tool: a delete erases saved cards, so it stays a REST call your own code makes on purpose.\n\n## Routes\n\n| Method and path | Scope | Purpose |\n|---|---|---|\n| `POST /v1/customers` | `customers:write` | Create (Idempotency-Key) |\n| `GET /v1/customers` | `customers:read` | List |\n| `GET /v1/customers/{customer_id}` | `customers:read` | Read; a deleted one reads `deleted: true` |\n| `PATCH /v1/customers/{customer_id}` | `customers:write` | Change fields; link `stripe_id` |\n| `DELETE /v1/customers/{customer_id}` | `customers:write` | Delete, with the refusals above |","updated":1795275945}