Skip to main content

Analytics

Access dashboard metrics, revenue trends, reports, and business insights. Access via zenpays.analytics.

Dashboard​

getDashboardOverview​

const overview = await zenpays.analytics.getDashboardOverview('30d')

getBusinessInsights​

const insights = await zenpays.analytics.getBusinessInsights()

Revenue​

getRevenueTrends​

const trends = await zenpays.analytics.getRevenueTrends('30d', 'day') // granularity: 'hour' | 'day' | 'week' | 'month'

getRevenueMetrics​

const metrics = await zenpays.analytics.getRevenueMetrics('30d')

Payments​

getPaymentMethodBreakdown​

const breakdown = await zenpays.analytics.getPaymentMethodBreakdown('30d')

getPaymentStatusDistribution​

const distribution = await zenpays.analytics.getPaymentStatusDistribution('30d')

getRecentPayments​

const payments = await zenpays.analytics.getRecentPayments(10)

getFailedPaymentsAnalysis​

const analysis = await zenpays.analytics.getFailedPaymentsAnalysis('30d')

Customers​

getTopCustomers​

const customers = await zenpays.analytics.getTopCustomers(10, '30d')

getRecentCustomerActivity​

const activity = await zenpays.analytics.getRecentCustomerActivity(10)
// Returns: [{ customerId, name, lastActivity, type }]

Reports​

generateReport​

const report = await zenpays.analytics.generateReport({
type: 'transactions',
format: 'pdf',
startDate: '2024-01-01',
endDate: '2024-12-31',
currency: 'INR',
})

listReports​

const { data } = await zenpays.analytics.listReports({ type: 'transactions', limit: 10 })

getReport​

const report = await zenpays.analytics.getReport('rpt_xxx')

downloadReport​

const downloadUrl = await zenpays.analytics.downloadReport('rpt_xxx')

Report Schedules​

createReportSchedule​

const schedule = await zenpays.analytics.createReportSchedule({
type: 'transactions',
format: 'csv',
frequency: 'weekly',
recipients: ['[email protected]'],
})

listReportSchedules​

const schedules = await zenpays.analytics.listReportSchedules()

updateReportSchedule​

const updated = await zenpays.analytics.updateReportSchedule('sched_xxx', {
frequency: 'monthly',
})

deleteReportSchedule​

await zenpays.analytics.deleteReportSchedule('sched_xxx')