Chargeback Stats
Retrieve aggregated chargeback statistics including totals, win/loss rates, and urgent deadlines.
GET
https://api.zenpayz.com/merchant/api/v1/chargebacks/statsBearer · API key
Request
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 |
Content-Type REQUIRED | application/json |
X-Merchant-Id REQUIRED | Merchant identifier |
X-Request-Id REQUIRED | Unique request identifier |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
startDate OPTIONAL | string | Start date filter (ISO 8601) |
endDate OPTIONAL | string | End date filter (ISO 8601) |
currency OPTIONAL | string | Filter by ISO 4217 currency code |
Response
Success (200 OK)
{
"success": true,
"data": {
"totalChargebacks": 142,
"activeDisputes": 18,
"disputedAmount": 12450.75,
"wonCount": 87,
"lostCount": 34,
"winRate": 71.9,
"urgentDeadlines": 5
},
"message": "Chargeback stats retrieved successfully",
"error": null,
"meta": {
"request_id": "req_xxxxx",
"timestamp": "2024-01-15T10:30:00.000Z",
"processing_time_ms": 55,
"api_version": "v1",
"endpoint": "GET /chargebacks/stats",
"user_type": "merchant"
}
}
Error Responses
| Code | HTTP | Message |
|---|---|---|
| VALIDATION_ERROR | 400 | Invalid query parameters |
| UNAUTHORIZED | 401 | Invalid API key |
Examples
- cURL
- JavaScript
- SDK
curl -X GET "https://api.zenpayz.com/merchant/api/v1/chargebacks/stats?startDate=2024-01-01T00:00:00.000Z&endDate=2024-01-31T23:59:59.000Z¤cy=USD" \
-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" \
-H "Content-Type: application/json" \
-H "X-Merchant-Id: merch_xxxxx" \
-H "X-Request-Id: req_xxxxx"
const params = new URLSearchParams({
startDate: '2024-01-01T00:00:00.000Z',
endDate: '2024-01-31T23:59:59.000Z',
currency: 'USD',
});
const response = await fetch(`https://api.zenpayz.com/merchant/api/v1/chargebacks/stats?${params}`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${apiKey}`,
'X-Timestamp': timestamp,
'X-Signature': signature,
'X-Secret-Salt': secretSalt,
'Content-Type': 'application/json',
'X-Merchant-Id': merchantId,
'X-Request-Id': requestId,
},
});
const result = await response.json();
console.log(result.data.totalChargebacks); // 142
console.log(result.data.winRate); // 71.9
console.log(result.data.urgentDeadlines); // 5
const stats = await zenpays.chargebacks.stats({
startDate: '2024-01-01T00:00:00.000Z',
endDate: '2024-01-31T23:59:59.000Z',
currency: 'USD',
});
console.log(stats.totalChargebacks); // 142
console.log(stats.winRate); // 71.9
console.log(stats.urgentDeadlines); // 5