Skip to main content

Customers

Manage customers, track risk profiles, and view activity. Access via zenpays.customers.

Methods​

create​

const customer = await zenpays.customers.create({
email: '[email protected]',
name: 'John Doe',
phone: '+911234567890',
country: 'IN',
})

get​

const customer = await zenpays.customers.get('cust_xxx')

update​

const updated = await zenpays.customers.update('cust_xxx', { name: 'Jane Doe' })

list​

const { data } = await zenpays.customers.list({ page: 1, limit: 20 })

const results = await zenpays.customers.search('[email protected]')

getRiskProfile​

const profile = await zenpays.customers.getRiskProfile('cust_xxx')

getActivityHistory​

const history = await zenpays.customers.getActivityHistory('cust_xxx', {
type: 'payment',
from: '2024-01-01',
to: '2024-12-31',
limit: 50,
})

getTopCustomers​

const top = await zenpays.customers.getTopCustomers({
startDate: '2024-01-01',
endDate: '2024-12-31',
limit: 10,
})

getRecentPayments​

const payments = await zenpays.customers.getRecentPayments({ limit: 10 })

getAnalytics​

const analytics = await zenpays.customers.getAnalytics({
startDate: '2024-01-01',
endDate: '2024-12-31',
})
// Returns: { totalCustomers, newCustomers, activeCustomers, churnRate }

block​

const blocked = await zenpays.customers.block('cust_xxx', 'Suspected fraud')

unblock​

const unblocked = await zenpays.customers.unblock('cust_xxx')