Customer API

Customer API จะช่วยสร้าง, เรียกข้อมูล, อัปเดต และ ลบลูกค้าออกได้ โดย “ลูกค้า” ในที่นี้เปรียบเหมือนตัวแทนของผู้ซื้อคืออาจมีหรือไม่มีบัตรที่บันทึกไว้กับระบบ โดยหากมีการกลับมาซื้อซ้ำจะสามารถเรียกใช้ได้อีก

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.

metadata object

Custom metadata (e.g. {"answer": 42}) for customer.

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.

metadata object

(optional) Custom metadata (e.g. {"answer": 42}) for customer.

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.

metadata object

(optional) Custom metadata (e.g. {"answer": 42}) for customer.

Example

  • Attach a card to a customer

  • Update customer default card

  • Update customer email and description

เว็ปไซต์นี้มีการใช้คุกกี้เพื่อวิเคราะห์การใช้และปรับการใช้งานให้เหมาะกับท่าน เมื่อกดยอมรับหรือยังคงเข้าชมเว็บไซต์ต่อ เราถือว่าท่านยินยอมในการใช้งานคุกกี้ของเว็บไซต์ อ่านนโยบายความเป็นส่วนตัว