Card API

The Card API allows you to retrieve, update, and delete credit card information for a given customer. New cards created from tokens can be added to new and existing customers.

Attribute

Name Type Description
object string

The string card.

id object_id

The CARD_ID matching /card(_test)?_[1-9a-z]+/.

livemode boolean

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

location string

API path to retrieve the current card object.

bank string

Bank name based on the issuer identification number of the card (first six digits). Note that this information is given for information only and may not always be 100% accurate.

brand string

Card brand (e.g. Visa, Mastercard).

city string

The city.

country string

Country code based on the card number following the ISO 3166 standard. Note that this information is given for information only and may not always be 100% accurate.

created datetime

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

deleted boolean

Whether the card is deleted.

expiration_month integer

Card expiration month (1-12).

expiration_year integer

Card expiration year.

financing string

Type of credit card financing (debit or credit). Note that this information is given for information only and may not always be 100% accurate.

fingerprint string

Unique card-based fingerprint. Allows detection of identical cards.

last_digits string

Last 4 digits of the card number.

name string

Card owner full name.

postal_code string

The postal code.

security_code_check boolean

Whether the card failed pre-authorization (i.e. security code check).

Example

  • Json Response

List all cards

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

Returns a list of all card objects belonging to the customer.

Request 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 number of records returned.

from datetime

(optional, default: 1970-01-01T00:00:00Z) The earliest UTC date and time for returned records in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

to datetime

(optional, default: current UTC datetime) The latest UTC date and time for returned records in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

order string

(optional, default: chronological) The order of the list returned. Either chronological (earliest to latest) or reverse_chronological (latest to earliest).

Example

  • List all cards

Retrieve a card

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

Returns a single card object which matches CARD_ID and belongs to the customer which matches CUSTOMER_ID.

Example

  • Retrieve a card

Update a card

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

Updates the card which matches CARD_ID and belongs to the customer which matches CUSTOMER_ID.

Request Parameter

Name Type Description
name string

(optional) The cardholder name as printed on the card.

expiration_month integer

(optional) The expiration month printed on the card.

expiration_year integer

(optional) The expiration year printed on the card in the format YYYY.

postal_code string

(optional) The postal code from the city where the card was issued.

city string

(optional) The city where the card was issued.

Example

  • Update a card

Destroy a card

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

Destroys the card which matches CARD_ID and belongs to the customer which matches CUSTOMER_ID.

Example

  • Destroy a card

  • JSON Response