Token API

Create and retrieve information about tokens. A token represents a credit or debit card. Once created, a token can be used to create a single charge or attached to a customer as a card to create multiple charges.

Full credit card data should never go through your server.

The endpoints described on this page should only be used with test data. In production, tokens should be created and sent directly to our servers from the client using Omise.js, or, if on mobile, the iOS or Android SDKs.

Sending card data from server requires a valid PCI-DSS certification in order to be compliant. You can learn more about this in Security Best Practices.

Attributes

Name Type Description
object string

The string token.

id object_id

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

livemode boolean

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

location string

API path to retrieve the current token object.

card card

Card containing details of card used to generate token.

charge_status string

Status of charge created using this token (if any). Value is one of allowed charge.status values or, no charge has been created, unknown.

created_at datetime

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

used boolean

Whether token has been used. Tokens can be used only once either to make a charge or to associate as a new card on a customer.

Example

  • JSON Response

Create a token

- POST https://vault.omise.co/tokens

Creates and returns a new token. Tokens are single-use only. This endpoint accepts public key authentication only.

Request Parameters

Name Type Description
card[expiration_month] integer

(required) Card expiration month (M or MM).

card[expiration_year] integer

(required) Card expiration year (YY or YYYY).

card[name] string

(required) Card owner name.

card[number] string

(required) Card number.

card[city] string

(optional, but recommended) Billing address city. Supplying the cardholder's billing address improves your authorization rate for US, UK, and Canadian cardholders.

card[country] string

(optional, but recommended) Billing address country as two-letter ISO 3166 code. Note: if not supplied at token creation, value derived from issuer identification number (IIN) so may not be accurate. Supplying the cardholder's billing address improves your authorization rate for US, UK, and Canadian cardholders.

card[postal_code] string

(optional, but recommended) Card postal code. Supplying the cardholder's billing address improves your authorization rate for US, UK, and Canadian cardholders.

card[security_code] string

(optional, but recommended) Card security code (CVV, CVC, etc). Printed on the back.

card[state] string

(optional, but recommended) Billing address state. Supplying the cardholder's billing address improves your authorization rate for US, UK, and Canadian cardholders.

card[street1] string

(optional, but recommended) Billing address street #1. Supplying the cardholder's billing address improves your authorization rate for US, UK, and Canadian cardholders.

card[phone_number] string

(optional) Phone number.

card[street2] string

(optional) Billing address street #2.

Example

  • Create a token

Create a token from a tokenized card

- POST https://vault.omise.co/tokens

Creates and returns a new token from a card that has already been tokenized. Tokens generated this way are single-use only and cannot be attached to a customer. This endpoint accepts public key authentication only.

Request Parameters

Name Type Description
tokenization[method] string

(required, one of: googlepay) Card tokenization method.

tokenization[data] string

(required) Tokenized card data generated by the corresponding tokenization method.

tokenization[billing_name] string

(optional, but recommended) Card owner name. If not supplied, a default name will appear on the card's details.

tokenization[billing_city] string

(optional, but recommended) Billing address city. Supplying the cardholder's billing address improves your authorization rate for US, UK, and Canadian cardholders.

tokenization[billing_country] string

(optional, but recommended) Billing address country as two-letter ISO 3166 code. Supplying the cardholder's billing address improves your authorization rate for US, UK, and Canadian cardholders.

tokenization[billing_postal_code] string

(optional, but recommended) Billing address postal code. Supplying the cardholder's billing address improves your authorization rate for US, UK, and Canadian cardholders.

tokenization[billing_state] string

(optional, but recommended) Billing address state. Supplying the cardholder's billing address improves your authorization rate for US, UK, and Canadian cardholders.

tokenization[billing_street1] string

(optional, but recommended) Billing address street #1. Supplying the cardholder's billing address improves your authorization rate for US, UK, and Canadian cardholders.

tokenization[billing_street2] string

(optional) Billing address street #2.

tokenization[billing_phone_number] string

(optional) Billing address phone number.

Retrieve a token

- GET https://vault.omise.co/tokens/{id}

Returns the token matching :id. Note: this endpoint accepts only public key authentication.

Example

  • Retrieve a token

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