Bulk Payouts
Upload a CSV with phone_number, amount, remarks, and occasion columns.
Always preview first. It returns every invalid row with its line number and reason, and submission is all-or-nothing: if any row fails — bad phone number, amount out of range, duplicate — nothing is scheduled. Fix the reported rows and upload the file again.
TypeScript
import { ProviderEnvironment } from "@vectapay/sdk";
import { readFile } from "node:fs/promises";
const file = new Blob([await readFile("payroll-october.csv")], { type: "text/csv" });
const preview = await vectapay.payouts.bulkPreview(ProviderEnvironment.PRODUCTION, {
file,
filename: "payroll-october.csv",
commandId: "SalaryPayment",
providerAccountId: "...",
});
// { totalRows, validRows, invalidRows, errors: [{ row, phoneNumber, reason }], sampleRows }
const batch = await vectapay.payouts.bulk(ProviderEnvironment.PRODUCTION, {
file,
filename: "payroll-october.csv",
commandId: "SalaryPayment",
providerAccountId: "...",
});
// { batchId, queued, errors, status, releaseAt, approvalRequired }Tracking a batch
TypeScript
const batches = await vectapay.payouts.listBatches({ limit: 20 });
const detail = await vectapay.payouts.getBatch(batchId, { limit: 50 });
// { batch: { totalRows, successCount, failedCount, ... }, payments: [...] }
// Retry only the rows that failed, without re-submitting the whole batch
await vectapay.payouts.retryFailedInBatch(batchId);A batch above your daily payout limit or single-payout approval threshold is held as a scheduled batch pending approval — see Approvals.
Last updated on