Create a customer
Saves a customer, so you can attach your own `metadata` before they pay and filter payments and subscriptions by `customer_id` afterwards. It is optional: a payment that succeeds matches a customer by lower-cased email within the same merchant and mode, and creates one when there is no match. `name` and `email` are required, the email is stored in lower case and must be free in this merchant and mode (`409 CUSTOMER_EXISTS`), and `phone_number` is E.164, like `+971501234567`. Send `Idempotency-Key` so a retried request does not save a second customer.
Saves a customer, so you can attach your own metadata before they pay and filter payments and subscriptions by customer_id afterwards. It is optional: a payment that succeeds matches a customer by lower-cased email within the same merchant and mode, and creates one when there is no match.
name and email are required, the email is stored in lower case and must be free in this merchant and mode (409 CUSTOMER_EXISTS), and phone_number is E.164, like +971501234567. Send Idempotency-Key so a retried request does not save a second customer.
Authorization
secretKey Your secret key: sk_live_… or sk_test_….
In: header
Header Parameters
Retrying with the same key returns the first response instead of creating a duplicate. 1 to 255 printable ASCII characters (INVALID_IDEMPOTENCY_KEY otherwise), remembered for 24 hours per key's merchant and mode. A replayed answer carries idempotent-replayed: true. The same key with a different body is refused with 422 IDEMPOTENCY_KEY_REUSED; while the first request is still running, 409 IDEMPOTENCY_KEY_IN_USE. A request that failed with a 5xx is not remembered, so it can simply be retried.
length <= 255Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X POST "https://example.com/customers" \ -H "Content-Type: application/json" \ -d '{ "email": "user@example.com", "name": "string" }'{ "object": "customer", "customer_id": "cus_3f2b8c1e9a4d4e7b8c2a1d5e6f7a8b9c", "name": "string", "email": "user@example.com", "phone_number": "string", "metadata": { "property1": "string", "property2": "string" }, "created_at": "2019-08-24T14:15:22Z"}Update a product PATCH
Changes a product in place. Fields you leave out keep their values, and `metadata` replaces what was stored rather than merging into it. Include `price` when changing `currency`, and a `billing_interval` when changing `billing` to `recurring`. Subscriptions that already exist keep the amount and interval they started with, so a change here reaches new checkouts only. A product cannot be deleted: set `status` to `archived` to stop selling it while older payments keep pointing at it.
Retrieve a customer GET
Returns one customer, with the metadata you stored on them. Only customers belonging to the key's merchant and mode are visible.