Retrieve a Customer
Retrieve complete information about a customer including their saved cards, email, description, and metadata.
API Credentials
Request Parametersโ
Required - 1 fieldRequired Parameters
`id`STRING(required)
The customer ID to retrieve (must start with cust_).
Responsesโ
200
Customer retrieved successfullyCustomer object returned with all details including saved cards.
Customer object includes:
id- Customer IDemail- Customer email addressdescription- Customer name or descriptiondefault_card- ID of default payment cardcards- List object with all saved cardsmetadata- Custom key-value datacreated_at- ISO 8601 timestamp of creation
401
UnauthorizedAuthentication 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 foundCustomer ID not found.
Common causes:
- Customer ID does not exist
- Customer has been deleted
- Incorrect customer ID format
Code samplesโ
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/customers/cust_test_5xuy4w91xqz7d1w9u0t \
-u skey_test_5xuy4w91xqz7d1w9u0t:
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
customer = Omise::Customer.retrieve('cust_test_5xuy4w91xqz7d1w9u0t')
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
customer = omise.Customer.retrieve('cust_test_5xuy4w91xqz7d1w9u0t')
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const customer = await omise.customers.retrieve('cust_test_5xuy4w91xqz7d1w9u0t');
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$customer = OmiseCustomer::retrieve('cust_test_5xuy4w91xqz7d1w9u0t');
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
Customer customer = client.customers().get("cust_test_5xuy4w91xqz7d1w9u0t");
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var customer = await client.Customers.Get("cust_test_5xuy4w91xqz7d1w9u0t");
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
customer, _ := client.Customers().Retrieve("cust_test_5xuy4w91xqz7d1w9u0t", nil)
Error and result codesโ
Common Error Codesโ
| Code | Description | Resolution |
|---|---|---|
authentication_failure | Invalid API key | Verify your secret key is correct |
not_found | Customer not found | Verify customer ID exists |
bad_request | Invalid customer ID format | Check ID starts with cust_ |
Customer Response Fieldsโ
| Field | Description |
|---|---|
id | Customer ID (cust_*) |
email | Customer email address |
description | Customer name or description |
default_card | ID of default payment card |
cards | List object with all saved cards |
cards.data | Array of card objects |
cards.total | Total number of saved cards |
metadata | Custom key-value data |
created_at | Customer creation timestamp |
Try it outโ
Required - 1 fields