Utopia PaymentsDocs
Customers

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.

POST
/customers

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
AuthorizationBearer <token>

Your secret key: sk_live_… or sk_test_….

In: header

Header Parameters

Idempotency-Key?string

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.

Lengthlength <= 255

Request 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"}