Payment Link Analytics
Retrieve payment link analytics including totals, usage statistics, and counts by status.
GET
https://api.zenpayz.com/merchant/api/v1/payment-links/analyticsBearer · 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 |
Response
Success (200 OK)
{
"success": true,
"data": {
"totalLinks": 75,
"totalAmountCollected": 450000.00,
"totalPayments": 120,
"byStatus": {
"ACTIVE": 40,
"INACTIVE": 25,
"EXPIRED": 10
},
"byUsageType": {
"SINGLE": 50,
"MULTI": 25
},
"averagePaymentAmount": 3750.00,
"conversionRate": 68.5
},
"message": "Payment link analytics retrieved successfully",
"error": null,
"meta": {
"request_id": "req_xxxxx",
"timestamp": "2024-01-15T10:30:00.000Z",
"processing_time_ms": 90,
"api_version": "v1",
"endpoint": "GET /payment-links/analytics",
"user_type": "merchant"
}
}
Error Responses
| Code | HTTP | Message |
|---|---|---|
| UNAUTHORIZED | 401 | Invalid API key |
Examples
- cURL
- JavaScript
- SDK
curl -X GET https://api.zenpayz.com/merchant/api/v1/payment-links/analytics \
-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"
const response = await fetch('https://api.zenpayz.com/merchant/api/v1/payment-links/analytics', {
method: 'GET',
headers: {
'Authorization': `Bearer ${apiKey}`,
'X-Timestamp': timestamp,
'X-Signature': signature,
'X-Secret-Salt': secretSalt,
'Content-Type': 'application/json',
},
});
const result = await response.json();
console.log(result.data.totalLinks); // 75
console.log(result.data.totalAmountCollected); // 450000.00
const analytics = await zenpays.paymentLinks.analytics();
console.log(analytics.totalLinks); // 75
console.log(analytics.totalAmountCollected); // 450000.00