Get Customer History
Retrieve transaction history for a specific customer.
GET
https://api.zenpayz.com/merchant/api/v1/customers/{customerId}/historyBearer · 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 |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
limit OPTIONAL | integer50 | Number of records to return |
Response
Success (200 OK)
{
"success": true,
"data": {
"customerId": "cust_a1b2c3d4e5f6g7h8",
"transactions": [
{
"id": "txn_xxxxx",
"amount": 1000,
"currency": "USD",
"status": "success",
"paymentMethod": "upi",
"createdAt": "2024-01-14T15:30:00.000Z"
}
],
"activities": [
{
"id": 1,
"activityType": "payment_completed",
"description": "Payment of 1000 USD completed",
"ipAddress": "203.0.113.42",
"deviceFingerprint": "fp_xxxxx",
"riskLevel": "low",
"isSuspicious": false,
"metadata": {},
"createdAt": "2024-01-14T15:30:00.000Z"
}
]
},
"message": "Customer history retrieved successfully",
"error": null,
"meta": {
"request_id": "req_xxxxx",
"timestamp": "2024-01-15T10:30:00.000Z",
"processing_time_ms": 95,
"api_version": "v1",
"endpoint": "GET /customers/:id/history",
"user_type": "merchant"
}
}
Examples
- cURL
- SDK
curl -X GET "https://api.zenpayz.com/merchant/api/v1/customers/cust_a1b2c3d4e5f6g7h8/history?limit=50" \
-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 history = await zenpays.customers.getHistory('cust_a1b2c3d4e5f6g7h8', { limit: 50 });
console.log(`Transactions: ${history.transactions.length}, Activities: ${history.activities.length}`);