Batch Settlement
Optimize costs by aggregating multiple payments into batched settlements.
Overview
Batch settlement combines multiple completed payments into a single on-chain transaction, reducing gas costs by up to 98%.
How It Works
Configuration
Settlement Schedule
// Configure in dashboard or via API
await pelago.merchants.updateSettings({
settlementSchedule: {
mode: 'scheduled', // 'instant' | 'scheduled' | 'threshold'
frequency: 'daily', // 'hourly' | 'daily' | 'weekly'
time: '18:00', // Settlement time (UTC)
timezone: 'UTC',
minimumAmount: 100.00 // Minimum batch size
}
});
Settlement Modes
| Mode | Description | Fee |
|---|---|---|
instant | Immediate settlement | 0.5% |
scheduled | Settles on schedule | 0.08% |
threshold | Settles when threshold met | 0.1% |
Manual Batch Settlement
Trigger settlement on demand:
const settlement = await pelago.settlements.createBatch({
paymentIds: ['pay_abc123', 'pay_def456', 'pay_ghi789']
});
console.log('Settlement ID:', settlement.id);
console.log('Total:', settlement.totalAmount);
Batch Reports
const batch = await pelago.settlements.retrieve('stl_abc123');
console.log('Batch:', batch.id);
console.log('Total:', batch.totalAmount);
console.log('Payments:', batch.paymentCount);
console.log('Fees:', batch.totalFees);
console.log('TX Hash:', batch.transactionHash);
Best Practices
- Balance frequency vs. cash flow - Daily works for most merchants
- Set minimum thresholds - Avoid micro-settlements
- Monitor failed settlements - Set up alerts