Skip to main content

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

ModeDescriptionFee
instantImmediate settlement0.5%
scheduledSettles on schedule0.08%
thresholdSettles when threshold met0.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

  1. Balance frequency vs. cash flow - Daily works for most merchants
  2. Set minimum thresholds - Avoid micro-settlements
  3. Monitor failed settlements - Set up alerts