Create a customer
/customersCreates a customer with a reference.
Headers
AuthorizationstringRequiredidempotency-keystringA 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_idstringRequiredYour 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.
emailstringThe customer's email address.
metadataobjectSet 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.
namestringThe customer's full name.
phonestringThe customer's phone number, preferably in E.164 format. The leading + is optional.
dobstringThe customer's date of birth in YYYY-MM-DD format.
national_identification_numberstringThe customer's national identification number.
addressobjectThe customer's billing address.
Show 6 child parametersHide child parameters
citystringCity, district, suburb, town, or village.
countrystringTwo-letter country code (ISO 3166-1 alpha-2).
line1stringAddress line 1 (for example, street, PO Box, or company name).
line2string or nullAddress line 2 (for example, apartment, suite, unit, or building). Responses return null when not set.
postal_codestringZIP or postal code.
statestring or nullState, county, province, or region. Null is accepted and returned when not set.
shippingobjectThe customer's shipping information.
Show 3 child parametersHide child parameters
addressobjectAddress details.
Show 6 child parametersHide child parameters
citystringCity, district, suburb, town, or village.
countrystringTwo-letter country code (ISO 3166-1 alpha-2).
line1stringAddress line 1 (for example, street, PO Box, or company name).
line2string or nullAddress line 2 (for example, apartment, suite, unit, or building). Responses return null when not set.
postal_codestringZIP or postal code.
statestring or nullState, county, province, or region. Null is accepted and returned when not set.
namestringFull name of the recipient.
phonestringPhone number of the recipient, preferably in E.164 format. The leading + is optional.
Returns
Returns the created customer object.
idstringUnique identifier for the Customer resource.
resourcestringString representing the object's type.
createdstringTime at which the object was created, in ISO 8601 format.
default_sourcestring or nullUnique identifier of the Customer's default Payment Method.
emailstring or nullThe customer's email address.
metadataobjectSet of key-value pairs attached to the object.
namestring or nullThe customer's full name.
phonestring or nullThe customer's phone number, if set.
Show 7 more attributesShow fewer attributes
reference_idstringYour unique identifier for the customer, used to retrieve and manage saved payment methods.
addressobject or nullThe customer's billing address, if set.
Show 2 child attributesHide child attributes
Option 1objectAddress details.
Show 6 child attributesHide child attributes
citystringCity, district, suburb, town, or village.
countrystringTwo-letter country code (ISO 3166-1 alpha-2).
line1stringAddress line 1 (for example, street, PO Box, or company name).
line2string or nullAddress line 2 (for example, apartment, suite, unit, or building). Responses return null when not set.
postal_codestringZIP or postal code.
statestring or nullState, county, province, or region. Null is accepted and returned when not set.
Option 2nullshippingobject or nullThe customer's shipping information, if set.
Show 2 child attributesHide child attributes
Option 1objectShipping information for the payment.
Show 3 child attributesHide child attributes
addressobjectAddress details.
Show 6 child attributesHide child attributes
citystringCity, district, suburb, town, or village.
countrystringTwo-letter country code (ISO 3166-1 alpha-2).
line1stringAddress line 1 (for example, street, PO Box, or company name).
line2string or nullAddress line 2 (for example, apartment, suite, unit, or building). Responses return null when not set.
postal_codestringZIP or postal code.
statestring or nullState, county, province, or region. Null is accepted and returned when not set.
namestringFull name of the recipient.
phonestringPhone number of the recipient, preferably in E.164 format. The leading + is optional.
Option 2nulltest_modebooleanWhether the customer was created in the sandbox.
dobstring or nullThe customer's date of birth in YYYY-MM-DD format, if set.
national_identification_numberstring or nullThe customer's national identification number.
underlying_identifiersobjectProvider-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
400reference_id already exists.401invalid_key, invalid_token, legacy_keys_ended, legacy_keys_off or permission_denied).403resource_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.409idempotency-key is still being processed (request_in_progress). Wait, then retry with the same key.500503Retry-After, or after a few seconds when there's none.