Customer API

Create, retrieve, update, and delete customers. When unused token identifiers are added to customers, they are saved as cards which can be used for repeated purchases.

Attributes

Name Type Description
object string

The string customer.

id string

The customer identifier matching /cust(_test)?_[0-9a-z]+/.

livemode boolean

Whether this is a live (true) or test (false) customer.

location string

API path to retrieve the current customer object.

cards list

List of cards belonging to the customer.

created_at string

UTC datetime of customer creation in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

default_card object_id_expandable

Identifier of default card for creating charges. Initially, value is first card assigned to a customer. If default card is deleted, the latest card added will be set as default. null if no cards.

deleted boolean

Whether customer is deleted.

description string

Customer description.

email string

Customer email address. Used when the customer's email is not supplied during token creation.

linked_accounts list

List of accounts linked for direct debit.

metadata object

Custom metadata (e.g. {answer: 42}) for a customer. The maximum field length is 15.000 characters.

Example

  • JSON Response

Create a customer (and card)

- POST https://api.omise.co/customers

Creates and returns a new customer. This endpoint can also create a new card if an unused token is provided for the card parameter.

Request Parameters

Name Type Description
card string

(optional) An unused token identifier to add as a new card to the customer.

description string

(optional, but recommended) Description for customer. Supplying any additional details about the customer helps Opn Payments better conduct fraud analysis.

email string

(optional, but recommended) Email address for customer. Supplying the customer's email address helps Opn Payments better conduct fraud analysis.

linked_account string

(optional) The account that is linked for direct debit.

metadata object

(optional) Custom metadata (e.g. {answer: 42}) for a customer. The maximum field length is 15.000 characters.

Example

  • Create a customer while attaching a card

  • Create a customer

Destroy a customer

- DELETE https://api.omise.co/customers/{id}

Destroys the customer matching :id.

Example

  • Destroy a customer

List customers

- GET https://api.omise.co/customers

Returns a list of customers belonging to your account.

Request Parameters

Name Type Description
from string

(optional, default: 1970-01-01T00:00:00Z) Earliest UTC datetime for returned records in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

limit integer

(optional, default: 20) Number of records returned.

offset integer

(optional, default: 0) Offset of the first record returned (i.e. how many records to skip from the beginning).

order string

(optional, default: chronological, one of: chronological, reverse_chronological) Order of records returned.

to string

(optional) Latest UTC datetime for returned records in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

Example

  • List all customers

Retrieve a customer

- GET https://api.omise.co/customers/{id}

Returns the customer matching :id.

Example

  • Retrieve a customer

Update a customer

- PATCH https://api.omise.co/customers/{id}

Updates and returns the updated customer matching :id.

Request Parameters

Name Type Description
card string

(optional) An unused token identifier to add as a new card to the customer.

default_card string

(optional) Identifier of the default card for creating charges.

description string

(optional, but recommended) Description for customer. Supplying any additional details about the customer helps Opn Payments better conduct fraud analysis.

email string

(optional, but recommended) Email address for customer. Supplying the customer's email address helps Opn Payments better conduct fraud analysis.

linked_account string

(optional) The account that is linked for direct debit.

metadata object

(optional) Custom metadata (e.g. {answer: 42}) for a customer. The maximum field length is 15.000 characters.

Example

  • Attach a card to a customer

  • Update customer default card

  • Update customer email and description

Omise uses cookies to improve your overall site experience and collect information on your visits and browsing behavior. By continuing to browse our website, you agree to our Privacy Policy. Learn more