ePOS
The client.epos namespace provides two sub-namespaces: payments for transaction operations and terminals for terminal and outlet management.
Amount units: All amount.value fields use minor currency units (e.g., 2500 = €25.00). Specify the currency with amount.currencyCode.
Payments
Create Payment
Code Example
TypeScript
const result = await client.epos.payments.create({
amount: {
value: 2500,
currencyCode: 'EUR',
},
terminalId: 'TERM_001',
appName: 'MyShopApp',
appVersion: '1.0.0',
})
if (result.success) {
console.log('Payment created:', result.data.paymentId)
}Code Example
JavaScript
const result = await client.epos.payments.create({
amount: {
value: 2500,
currencyCode: 'EUR',
},
terminalId: 'TERM_001',
appName: 'MyShopApp',
appVersion: '1.0.0',
})
if (result.success) {
console.log('Payment created:', result.data.paymentId)
}Get Payment
Code Example
TypeScript
const result = await client.epos.payments.get('payment_id_123')
if (result.success) {
console.log('Status: ' + result.data.status + ' - ' + (result.data.amount.value / 100) + ' ' + result.data.amount.currencyCode)
}Code Example
JavaScript
const result = await client.epos.payments.get('payment_id_123')List Payments by Terminal
Code Example
TypeScript
const result = await client.epos.payments.list({ terminalId: 'TERM_001', page: 1, size: 20 })
if (result.success) {
for (const payment of result.data.items) {
console.log(payment.paymentId + ' - ' + payment.status)
}
}Code Example
JavaScript
const result = await client.epos.payments.list({ terminalId: 'TERM_001', page: 1, size: 20 })Cancel Payment
Code Example
TypeScript
const result = await client.epos.payments.cancel('payment_id_123')
if (result.success) {
console.log('Payment cancelled')
}Code Example
JavaScript
const result = await client.epos.payments.cancel('payment_id_123')Reverse Payment
Code Example
TypeScript
const result = await client.epos.payments.reverse('payment_id_123', {
description: 'Customer requested cancellation',
})
if (result.success) {
console.log('Payment reversed')
}Code Example
JavaScript
const result = await client.epos.payments.reverse('payment_id_123', {
description: 'Customer requested cancellation',
})Refund Payment (partial)
Code Example
TypeScript
const result = await client.epos.payments.refund('payment_id_123', {
amount: {
value: 1000,
currencyCode: 'EUR',
},
})
if (result.success) {
console.log('Partial refund of €10.00 issued')
}Code Example
JavaScript
const result = await client.epos.payments.refund('payment_id_123', {
amount: { value: 1000, currencyCode: 'EUR' },
})Terminals
List & Get Terminals
Code Example
TypeScript
// List all terminals
const listResult = await client.epos.terminals.list({ page: 1, size: 20 })
// Get a specific terminal
const getResult = await client.epos.terminals.get('TERM_001')
if (getResult.success) {
console.log('Terminal: ' + getResult.data.terminalId + ' - ' + getResult.data.status)
}Code Example
JavaScript
const listResult = await client.epos.terminals.list({ page: 1, size: 20 })
const getResult = await client.epos.terminals.get('TERM_001')Terminal Transactions
Code Example
TypeScript
// All transaction types for a terminal in a date range
const txnResult = await client.epos.terminals.getTransactions({
terminalId: 'TERM_001',
fromDate: '2024-01-01',
toDate: '2024-01-31',
})
// Per-terminal transaction list with pagination
const perTermResult = await client.epos.terminals.getTerminalTransactions({
terminalId: 'TERM_001',
fromDate: '2024-01-01',
toDate: '2024-01-31',
page: 1,
size: 50,
})Code Example
JavaScript
const txnResult = await client.epos.terminals.getTransactions({
terminalId: 'TERM_001',
fromDate: '2024-01-01',
toDate: '2024-01-31',
})
const perTermResult = await client.epos.terminals.getTerminalTransactions({
terminalId: 'TERM_001',
fromDate: '2024-01-01',
toDate: '2024-01-31',
page: 1,
size: 50,
})Terminal Management
Code Example
TypeScript
// Get available terminal models
const models = await client.epos.terminals.getModels()
// Get outlets
const outlets = await client.epos.terminals.getOutlets()
// Activate terminal
const activateResult = await client.epos.terminals.activate('TERM_001', {
activationCode: 'ACT-12345',
})
// Deactivate terminal
const deactivateResult = await client.epos.terminals.deactivate('TERM_001', {
activationCode: 'ACT-12345',
})
// Get payment receipt
const receipt = await client.epos.terminals.getReceipt('payment_id_123')
// Terminal-level refund
const refundResult = await client.epos.terminals.refund('TERM_001', {
originalPaymentId: 'payment_id_123',
amount: { value: 500, currencyCode: 'EUR' },
})Code Example
JavaScript
const models = await client.epos.terminals.getModels()
const outlets = await client.epos.terminals.getOutlets()
const activateResult = await client.epos.terminals.activate('TERM_001', { activationCode: 'ACT-12345' })
const deactivateResult = await client.epos.terminals.deactivate('TERM_001', { activationCode: 'ACT-12345' })
const receipt = await client.epos.terminals.getReceipt('payment_id_123')
const refundResult = await client.epos.terminals.refund('TERM_001', {
originalPaymentId: 'payment_id_123',
amount: { value: 500, currencyCode: 'EUR' },
})