Skip to main content
Version: 2019-05-29 (Current)

Create a Customer

Create a customer profile to save payment methods for repeat billing. Customers can have multiple saved cards and make future purchases without re-entering card details.


๐Ÿ”‘API Credentials

Request Parametersโ€‹

Recommended - 2 fieldsRecommended Parameters
โ–ผ
`email`STRING(optional)
Customer email address. Used for receipts, refund notifications, and support.
Example:"john@example.com"
`description`STRING(optional)
Customer name or description. Helps identify customers in your dashboard and reports.
Example:"John Doe"
Additional - 2 fieldsAdditional Parameters

Responsesโ€‹

200

Customer created successfully

Customer profile created. The customer ID should be stored in your database for future charges.

Customer object fields:
  • id - Customer ID (cust_*). Store this in your database.
  • email - Customer email address.
  • description - Customer description/name.
  • default_card - ID of the default payment card (if card was provided).
  • cards - List object containing all saved cards.
  • metadata - Custom key-value data.

400

Bad request

Request validation failed. Check the error message for details.

Common causes:
  • Invalid email format
  • Invalid token ID
  • Metadata exceeds 15,000 characters

401

Unauthorized

Authentication failed. Invalid or missing API key.

Common causes:
  • Missing Authorization header
  • Invalid secret key
  • Using public key instead of secret key
  • Incorrect HTTP Basic Auth format

404

Not found

Token not found or invalid.

Common causes:
  • Token ID does not exist
  • Token has already been used
  • Token has expired

Code samplesโ€‹

curl https://api.omise.co/customers \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-d "email=john@example.com" \
-d "description=John Doe" \
-d "card=tokn_test_5xuy4w91xqz7d1w9u0t"

Error and result codesโ€‹

Common Error Codesโ€‹

CodeDescriptionResolution
bad_requestMissing or invalid parametersCheck email format and metadata size
authentication_failureInvalid API keyVerify your secret key is correct
used_tokenToken has already been usedGenerate a new token
token_not_foundToken ID does not existVerify token ID is correct
invalid_cardCard token is invalidCheck token was created successfully

Customer Fieldsโ€‹

FieldDescription
idCustomer ID (store this in your database)
emailCustomer email address
descriptionCustomer name or description
default_cardID of default payment card
cardsList of all saved cards
metadataCustom key-value data
created_atCustomer creation timestamp

Try it outโ€‹

Recommended - 2 fields
Additional - 2 fields