Get Daily Ledger Summaries
Retrieve historical daily ledger summaries for a date range. This endpoint returns an array of daily summaries, useful for trend analysis and reporting.
GET
https://api.zenpayz.com/merchant/api/v1/ledger/summariesBearer · 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 |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
startDate REQUIRED | string- | Start date in YYYY-MM-DD format |
endDate REQUIRED | string- | End date in YYYY-MM-DD format |
currency OPTIONAL | string- | Filter by currency code (e.g., INR, USD) |
Response
Success (200 OK)
{
"success": true,
"data": [
{
"summaryId": "sum_20240113_mer_xyz789",
"summaryDate": "2024-01-13",
"merchantId": "mer_xyz789",
"currency": "INR",
"openingAvailableBalance": 85000,
"closingAvailableBalance": 95000,
"openingPendingBalance": 3000,
"closingPendingBalance": 4500,
"openingBlockedBalance": 1500,
"closingBlockedBalance": 2000,
"totalDepositsGross": 15000,
"totalDepositsNet": 14250,
"depositCount": 8,
"totalDepositFees": 750,
"totalPayouts": 4000,
"payoutCount": 2,
"totalPayoutFees": 100,
"totalRefunds": 500,
"refundCount": 1,
"totalChargebacks": 0,
"chargebackCount": 0,
"totalSettlements": 0,
"settlementCount": 0,
"totalFeesCollected": 850,
"totalTransactionCount": 11,
"grossTransactionValue": 19500,
"netMovement": 10000,
"generatedAt": "2024-01-14T00:05:00.000Z",
"isFinalized": true
},
{
"summaryId": "sum_20240114_mer_xyz789",
"summaryDate": "2024-01-14",
"merchantId": "mer_xyz789",
"currency": "INR",
"openingAvailableBalance": 95000,
"closingAvailableBalance": 100000,
"openingPendingBalance": 4500,
"closingPendingBalance": 5000,
"openingBlockedBalance": 2000,
"closingBlockedBalance": 2000,
"totalDepositsGross": 8000,
"totalDepositsNet": 7600,
"depositCount": 5,
"totalDepositFees": 400,
"totalPayouts": 2500,
"payoutCount": 1,
"totalPayoutFees": 75,
"totalRefunds": 0,
"refundCount": 0,
"totalChargebacks": 0,
"chargebackCount": 0,
"totalSettlements": 0,
"settlementCount": 0,
"totalFeesCollected": 475,
"totalTransactionCount": 6,
"grossTransactionValue": 10500,
"netMovement": 5000,
"generatedAt": "2024-01-15T00:05:00.000Z",
"isFinalized": true
},
{
"summaryId": "sum_20240115_mer_xyz789",
"summaryDate": "2024-01-15",
"merchantId": "mer_xyz789",
"currency": "INR",
"openingAvailableBalance": 100000,
"closingAvailableBalance": 125000,
"openingPendingBalance": 5000,
"closingPendingBalance": 7500,
"openingBlockedBalance": 2000,
"closingBlockedBalance": 3000,
"totalDepositsGross": 35000,
"totalDepositsNet": 33250,
"depositCount": 15,
"totalDepositFees": 1750,
"totalPayouts": 8000,
"payoutCount": 3,
"totalPayoutFees": 250,
"totalRefunds": 1500,
"refundCount": 2,
"totalChargebacks": 500,
"chargebackCount": 1,
"totalSettlements": 0,
"settlementCount": 0,
"totalFeesCollected": 2000,
"totalTransactionCount": 21,
"grossTransactionValue": 45000,
"netMovement": 25000,
"generatedAt": "2024-01-16T00:05:00.000Z",
"isFinalized": true
}
],
"message": "Daily summaries retrieved successfully"
}
Notes
- Summaries are returned in chronological order (oldest first)
- Days without any transactions may not have a summary record
- The
isFinalizedfield indicates whether the day is closed; today's summary may not be finalized - Maximum date range is typically 90 days; for longer periods, make multiple requests
Examples
- cURL
- SDK
# Get last 7 days of summaries
curl -X GET "https://api.zenpays.com/merchant/api/v1/ledger/summaries?startDate=2024-01-09&endDate=2024-01-15¤cy=INR" \
-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"
// Get last 30 days of summaries
const endDate = new Date();
const startDate = new Date();
startDate.setDate(startDate.getDate() - 30);
const summaries = await zenpays.ledger.getDailySummaries({
startDate: startDate.toISOString().split('T')[0],
endDate: endDate.toISOString().split('T')[0],
currency: 'INR'
});
// Calculate period totals
const periodTotals = summaries.reduce((acc, day) => ({
totalDeposits: acc.totalDeposits + day.totalDepositsGross,
totalPayouts: acc.totalPayouts + day.totalPayouts,
totalFees: acc.totalFees + day.totalFeesCollected,
totalTransactions: acc.totalTransactions + day.totalTransactionCount,
}), { totalDeposits: 0, totalPayouts: 0, totalFees: 0, totalTransactions: 0 });
console.log('30-Day Period Summary:');
console.log(`Total Deposits: ${periodTotals.totalDeposits}`);
console.log(`Total Payouts: ${periodTotals.totalPayouts}`);
console.log(`Total Fees: ${periodTotals.totalFees}`);
console.log(`Total Transactions: ${periodTotals.totalTransactions}`);
// Calculate daily averages
const avgDailyDeposits = periodTotals.totalDeposits / summaries.length;
const avgDailyTransactions = periodTotals.totalTransactions / summaries.length;
console.log(`\nDaily Averages:`);
console.log(`Avg Daily Deposits: ${avgDailyDeposits.toFixed(2)}`);
console.log(`Avg Daily Transactions: ${avgDailyTransactions.toFixed(2)}`);
// Find best and worst days
const bestDay = summaries.reduce((best, day) =>
day.totalDepositsGross > best.totalDepositsGross ? day : best
);
const worstDay = summaries.reduce((worst, day) =>
day.totalDepositsGross < worst.totalDepositsGross ? day : worst
);
console.log(`\nBest Day: ${bestDay.summaryDate} (${bestDay.totalDepositsGross} deposits)`);
console.log(`Worst Day: ${worstDay.summaryDate} (${worstDay.totalDepositsGross} deposits)`);
// Trend analysis: week-over-week growth
const firstWeek = summaries.slice(0, 7);
const lastWeek = summaries.slice(-7);
const firstWeekTotal = firstWeek.reduce((sum, day) => sum + day.totalDepositsGross, 0);
const lastWeekTotal = lastWeek.reduce((sum, day) => sum + day.totalDepositsGross, 0);
const weeklyGrowth = ((lastWeekTotal - firstWeekTotal) / firstWeekTotal * 100).toFixed(2);
console.log(`\nWeek-over-week growth: ${weeklyGrowth}%`);