Get Customer
Retrieve details of a specific customer by ID.
GET
https://api.zenpayz.com/merchant/api/v1/customers/{customerId}Bearer · API key
Request
Path Parameters
| Parameter | Type | Description |
|---|---|---|
customerId REQUIRED | string | Customer ID (e.g., cust_a1b2c3d4e5f6g7h8) |
Headers
| Header | Description |
|---|---|
Authorization REQUIRED | Bearer {api_key} |
X-Signature REQUIRED | HMAC-SHA256 signature |
X-Timestamp REQUIRED | ISO 8601 timestamp |
X-Secret-Salt REQUIRED | Secret salt for HMAC validation |
Response
Success (200 OK)
{
"success": true,
"data": {
"customerId": "cust_a1b2c3d4e5f6g7h8",
"email": "john@example.com",
"phone": "+1234567890",
"firstName": "John",
"lastName": "Doe",
"country": "US",
"status": "active",
"riskLevel": "low",
"riskScore": 15,
"totalTransactions": 15,
"totalAmount": 25000,
"successfulTransactions": 14,
"failedTransactions": 1,
"averageTransactionAmount": 1785.71,
"lastTransactionDate": "2024-01-14T15:30:00.000Z",
"createdAt": "2024-01-01T10:00:00.000Z",
"updatedAt": "2024-01-14T15:30:00.000Z"
},
"message": "Customer retrieved successfully",
"error": null,
"meta": {
"request_id": "req_xxxxx",
"timestamp": "2024-01-15T10:30:00.000Z",
"processing_time_ms": 45,
"api_version": "v1",
"endpoint": "GET /customers/:id",
"user_type": "merchant"
}
}
Error Responses
| Code | HTTP | Message |
|---|---|---|
| UNAUTHORIZED | 401 | Invalid API key |
| CUSTOMER_NOT_FOUND | 404 | Customer doesn't exist |
Examples
- cURL
- SDK
curl -X GET "https://api.zenpayz.com/merchant/api/v1/customers/cust_a1b2c3d4e5f6g7h8" \
-H "Authorization: Bearer zp_test_xxxxx" \
-H "X-Timestamp: 2024-01-15T10:30:00.000Z" \
-H "X-Signature: a1b2c3d4e5f6..." \
-H "X-Secret-Salt: your_secret_salt"
const customer = await zenpays.customers.get('cust_a1b2c3d4e5f6g7h8');
console.log(customer.email); // john@example.com