Skip to Content
Docs
Customers

Create a customer

POST/customers

Creates a customer with a reference.

Headers

AuthorizationstringRequired
HTTP Basic auth: your API key as the password, with an empty username. See Authentication.
idempotency-keystring

A unique key, such as a UUID, that makes a POST or DELETE request safe to retry. Pay.com keeps each key for 24 hours, separately for each workspace.

  • A retry with the same key, endpoint and body gets the first request's stored status and body, without running the request again.
  • If the first request is still being processed, a retry gets 409 idempotency_error (request_in_progress).
  • The same key on another endpoint, or with another body, gets 400 idempotency_error (invalid_parameters).
  • GET, PUT and PATCH requests ignore the key.

The response repeats the key in its Idempotency-Key header.

Parameters

reference_idstringRequired

Your unique identifier for the customer, such as the customer ID in your system. Used later to retrieve and manage the customer's saved payment methods.

emailstring

The customer's email address.

metadataobject

Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the object in a structured format.

namestring

The customer's full name.

phonestring

The customer's phone number, preferably in E.164 format. The leading + is optional.

dobstring

The customer's date of birth in YYYY-MM-DD format.

national_identification_numberstring

The customer's national identification number.

addressobject

The customer's billing address.

Show 6 child parametersHide child parameters
citystring

City, district, suburb, town, or village.

countrystring

Two-letter country code (ISO 3166-1 alpha-2).

line1string

Address line 1 (for example, street, PO Box, or company name).

line2string or null

Address line 2 (for example, apartment, suite, unit, or building). Responses return null when not set.

postal_codestring

ZIP or postal code.

statestring or null

State, county, province, or region. Null is accepted and returned when not set.

shippingobject

The customer's shipping information.

Show 3 child parametersHide child parameters
addressobject

Address details.

Show 6 child parametersHide child parameters
citystring

City, district, suburb, town, or village.

countrystring

Two-letter country code (ISO 3166-1 alpha-2).

line1string

Address line 1 (for example, street, PO Box, or company name).

line2string or null

Address line 2 (for example, apartment, suite, unit, or building). Responses return null when not set.

postal_codestring

ZIP or postal code.

statestring or null

State, county, province, or region. Null is accepted and returned when not set.

namestring

Full name of the recipient.

phonestring

Phone number of the recipient, preferably in E.164 format. The leading + is optional.

Returns

Returns the created customer object.

idstring

Unique identifier for the Customer resource.

resourcestring

String representing the object's type.

createdstring

Time at which the object was created, in ISO 8601 format.

default_sourcestring or null

Unique identifier of the Customer's default Payment Method.

emailstring or null

The customer's email address.

metadataobject

Set of key-value pairs attached to the object.

namestring or null

The customer's full name.

phonestring or null

The customer's phone number, if set.

Show 7 more attributesShow fewer attributes
reference_idstring

Your unique identifier for the customer, used to retrieve and manage saved payment methods.

addressobject or null

The customer's billing address, if set.

Show 2 child attributesHide child attributes
Option 1object

Address details.

Show 6 child attributesHide child attributes
citystring

City, district, suburb, town, or village.

countrystring

Two-letter country code (ISO 3166-1 alpha-2).

line1string

Address line 1 (for example, street, PO Box, or company name).

line2string or null

Address line 2 (for example, apartment, suite, unit, or building). Responses return null when not set.

postal_codestring

ZIP or postal code.

statestring or null

State, county, province, or region. Null is accepted and returned when not set.

Option 2null
shippingobject or null

The customer's shipping information, if set.

Show 2 child attributesHide child attributes
Option 1object

Shipping information for the payment.

Show 3 child attributesHide child attributes
addressobject

Address details.

Show 6 child attributesHide child attributes
citystring

City, district, suburb, town, or village.

countrystring

Two-letter country code (ISO 3166-1 alpha-2).

line1string

Address line 1 (for example, street, PO Box, or company name).

line2string or null

Address line 2 (for example, apartment, suite, unit, or building). Responses return null when not set.

postal_codestring

ZIP or postal code.

statestring or null

State, county, province, or region. Null is accepted and returned when not set.

namestring

Full name of the recipient.

phonestring

Phone number of the recipient, preferably in E.164 format. The leading + is optional.

Option 2null
test_modeboolean

Whether the customer was created in the sandbox.

dobstring or null

The customer's date of birth in YYYY-MM-DD format, if set.

national_identification_numberstring or null

The customer's national identification number.

underlying_identifiersobject

Provider-specific customer identifiers, keyed by provider and then by a provider-side account or MID. Only present when the underlying identifiers map feature is enabled for your account; otherwise the field is omitted.

Errors

400
Invalid request parameters. Also returned when a customer with the same reference_id already exists.
401
The API key or access token is missing, unknown or no longer works (invalid_key, invalid_token, legacy_keys_ended, legacy_keys_off or permission_denied).
403
The request was refused: the API key may not make it (for example resource_not_allowed, key_disabled, network_not_allowed, pci_required or merchant_required), or this resource isn't enabled for your account (permission_denied). code says why.
409
Another request with the same idempotency-key is still being processed (request_in_progress). Wait, then retry with the same key.
500
Internal server error.
503
Service unavailable. Retry after the number of seconds in Retry-After, or after a few seconds when there's none.
Was this page helpful?