Customer API

Attribute

Name Type Description
object string

The string customer.

id object_id

The CUSTOMER_ID.

livemode boolean

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

location string

Path to retrieve the customer.

default_card string

CARD_ID of the card used as default when creating charge with a customer. The default card is the first card assigned to a customer. If the current default card is destroyed the latest card added will be set as default card and null in case there's no cards left.

email string

Email of the customer supplied during creation.

description string

Description of the customer supplied during creation.

metadata Hash

Metadata JSON hash.

created datetime

Creation date of the customer in ISO 8601 format.

cards list

A paginated list of card objects.

Example

  • Json Response

List all customers

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

Returns a list of customer objects.

Return all customers that belongs to your account since the beginning of time. You can learn more about lists in the pagination documentation

Query Parameter

Name Type Description
offset integer

(optional, default: 0) The offset of the first record returned. I.e.: How many records to skip from the beginning.

limit integer

(optional, default: 20, maximum: 100) The maximum amount of records returned.

from datetime

(optional, default: 1970-01-01T00:00:00Z, format: ISO 8601) The UTC date and time limiting the beginning of returned records. E.g.: 2014-10-20T00:00:00Z

to datetime

(optional, default: current UTC Datetime, format: ISO 8601) The UTC date and time limiting the end of returned records. E.g.: 2015-01-20T00:00:00Z

order string

(optional, default: chronological) The order of the list returned. I.e.: chronological (from earliest to latest), reverse_chronological (from latest to earliest).

Example

  • List all customers

Create a customer

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

Returns a new customer object

Request Parameter

Name Type Description
email string

(optional) Customer's email.

description string

(optional) A custom description for the customer.

metadata Hash

(optional) Any JSON hash you would like to attach to this customer. You can use this key to store email, user ID or internal reference ID.

card object_id

(optional) A card token in case you want to add a card to the customer.

Example

  • Create a customer

  • Create a customer and attach a card

Retrieve a customer

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

Returns an existing customer object

Example

  • Retrieve a customer

Update a customer

- PATCH https://api.omise.co/customers/CUSTOMER_ID

Returns the updated customer object

Request Parameter

Name Type Description
email string

(optional) Customer's email.

description string

(optional) A custom description for the customer.

metadata Hash

(optional) Any JSON hash you would like to attach to this charge. You can use this key to store email, user ID or internal reference ID.

card object_id

(optional) A card token in case you want to add a card to the customer.

Example

  • Update a customer

  • Attach a card to a customer

Destroy a customer

- DELETE https://api.omise.co/customers/CUSTOMER_ID

Returns the destroyed customer object

Example

  • Destroy a customer

  • Response (JSON)