paystack-transfers
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePaystack Transfers
Paystack 转账
The Transfers API lets you send money from your Paystack balance to bank accounts and mobile wallets. Transfers require a pre-created transfer recipient.
Depends on: paystack-setup for thehelper.paystackRequest
Related: paystack-transfer-recipients for creating recipients before transfers.
Transfers API 允许你将资金从你的Paystack余额转账至银行账户和移动钱包。转账需要预先创建转账收款人。
依赖:paystack-setup 提供的工具函数。paystackRequest
相关技能:paystack-transfer-recipients,用于在转账前创建收款人。
Endpoints
端点
| Method | Endpoint | Description |
|---|---|---|
| POST | | Initiate a transfer |
| POST | | Finalize transfer (OTP) |
| POST | | Initiate bulk transfer |
| GET | | List transfers |
| GET | | Fetch a transfer |
| GET | | Verify a transfer |
| 方法 | 端点 | 描述 |
|---|---|---|
| POST | | 发起转账 |
| POST | | 完成转账(OTP验证) |
| POST | | 发起批量转账 |
| GET | | 列出转账记录 |
| GET | | 获取单笔转账详情 |
| GET | | 验证转账状态 |
Initiate Transfer
发起转账
POST /transferReturns status if OTP is disabled on your account, or if OTP is required.
pendingotp| Param | Type | Required | Description |
|---|---|---|---|
| string | Yes | |
| integer | Yes | Amount in subunits (kobo/pesewas) |
| string | Yes | Recipient code (e.g. |
| string | Yes | Unique identifier (16-50 chars, lowercase a-z, 0-9, |
| string | No | Reason for transfer (shows in customer's credit notification) |
| string | No | Currency code (defaults to |
| string | No | Required in Kenya for MPESA Paybill and Till transfers |
typescript
const transfer = await paystackRequest<{
transfer_code: string;
status: string;
reference: string;
amount: number;
}>("/transfer", {
method: "POST",
body: JSON.stringify({
source: "balance",
amount: 100000, // ₦1,000
recipient: "RCP_gd9vgag7n5lr5ix",
reference: `txf_${crypto.randomUUID()}`,
reason: "Vendor payment for January",
}),
});
// transfer.data.status → "pending" or "otp"
// transfer.data.transfer_code → "TRF_v5tip3zx8nna9o78"POST /transfer如果账户禁用OTP,返回状态为;如果需要OTP验证,返回状态为。
pendingotp| 参数 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| string | 是 | |
| integer | 是 | 金额(subunits单位,如科博/比塞瓦) |
| string | 是 | 收款人代码(例如 |
| string | 是 | 唯一标识符(16-50字符,小写a-z、0-9、 |
| string | 否 | 转账原因(会显示在客户的到账通知中) |
| string | 否 | 货币代码(默认值为 |
| string | 否 | 肯尼亚地区MPESA Paybill和Till转账时必填 |
typescript
const transfer = await paystackRequest<{
transfer_code: string;
status: string;
reference: string;
amount: number;
}>("/transfer", {
method: "POST",
body: JSON.stringify({
source: "balance",
amount: 100000, // ₦1,000
recipient: "RCP_gd9vgag7n5lr5ix",
reference: `txf_${crypto.randomUUID()}`,
reason: "Vendor payment for January",
}),
});
// transfer.data.status → "pending" or "otp"
// transfer.data.transfer_code → "TRF_v5tip3zx8nna9o78"Finalize Transfer
完成转账(OTP验证)
POST /transfer/finalize_transferRequired when transfer status is . Submit the OTP sent to your business phone.
otp| Param | Type | Required | Description |
|---|---|---|---|
| string | Yes | Transfer code from initiate response |
| string | Yes | OTP sent to business phone |
typescript
await paystackRequest("/transfer/finalize_transfer", {
method: "POST",
body: JSON.stringify({
transfer_code: "TRF_v5tip3zx8nna9o78",
otp: "928783",
}),
});POST /transfer/finalize_transfer当转账状态为时需要调用此接口。提交发送至企业手机号的OTP验证码。
otp| 参数 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| string | 是 | 发起转账接口返回的transfer_code |
| string | 是 | 发送至企业手机号的OTP验证码 |
typescript
await paystackRequest("/transfer/finalize_transfer", {
method: "POST",
body: JSON.stringify({
transfer_code: "TRF_v5tip3zx8nna9o78",
otp: "928783",
}),
});Initiate Bulk Transfer
发起批量转账
POST /transfer/bulkBatch multiple transfers in a single request. OTP must be disabled on your account to use this endpoint.
| Param | Type | Required | Description |
|---|---|---|---|
| string | Yes | |
| array | Yes | Array of transfer objects |
Each transfer object:
| Param | Type | Required | Description |
|---|---|---|---|
| integer | Yes | Amount in subunits |
| string | Yes | Recipient code |
| string | Yes | Unique reference (16-50 chars) |
| string | No | Transfer reason |
typescript
const result = await paystackRequest("/transfer/bulk", {
method: "POST",
body: JSON.stringify({
source: "balance",
currency: "NGN",
transfers: [
{
amount: 20000,
recipient: "RCP_gd9vgag7n5lr5ix",
reference: `txf_${crypto.randomUUID()}`,
reason: "Bonus for the week",
},
{
amount: 35000,
recipient: "RCP_m7ljkv8leesep7p",
reference: `txf_${crypto.randomUUID()}`,
reason: "January salary",
},
],
}),
});
// result.message → "2 transfers queued."POST /transfer/bulk在单个请求中批量处理多笔转账。使用此端点必须先在账户中禁用OTP。
| 参数 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| string | 是 | |
| array | 是 | 转账对象数组 |
每个转账对象的参数:
| 参数 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| integer | 是 | 金额(subunits单位) |
| string | 是 | 收款人代码 |
| string | 是 | 唯一参考号(16-50字符) |
| string | 否 | 转账原因 |
typescript
const result = await paystackRequest("/transfer/bulk", {
method: "POST",
body: JSON.stringify({
source: "balance",
currency: "NGN",
transfers: [
{
amount: 20000,
recipient: "RCP_gd9vgag7n5lr5ix",
reference: `txf_${crypto.randomUUID()}`,
reason: "Bonus for the week",
},
{
amount: 35000,
recipient: "RCP_m7ljkv8leesep7p",
reference: `txf_${crypto.randomUUID()}`,
reason: "January salary",
},
],
}),
});
// result.message → "2 transfers queued."List Transfers
列出转账记录
GET /transfer| Param | Type | Required | Description |
|---|---|---|---|
| integer | No | Records per page (default: 50) |
| integer | No | Page number (default: 1) |
| integer | No | Filter by recipient ID |
| datetime | No | Start date |
| datetime | No | End date |
typescript
const transfers = await paystackRequest("/transfer?perPage=20&page=1");GET /transfer| 参数 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| integer | 否 | 每页记录数(默认:50) |
| integer | 否 | 页码(默认:1) |
| integer | 否 | 按收款人ID筛选 |
| datetime | 否 | 起始日期 |
| datetime | 否 | 结束日期 |
typescript
const transfers = await paystackRequest("/transfer?perPage=20&page=1");Fetch Transfer
获取单笔转账详情
GET /transfer/:id_or_codetypescript
const transfer = await paystackRequest(
`/transfer/${encodeURIComponent("TRF_v5tip3zx8nna9o78")}`
);GET /transfer/:id_or_codetypescript
const transfer = await paystackRequest(
`/transfer/${encodeURIComponent("TRF_v5tip3zx8nna9o78")}`
);Verify Transfer
验证转账状态
GET /transfer/verify/:referenceVerify the status of a transfer using its reference.
typescript
const result = await paystackRequest(
`/transfer/verify/${encodeURIComponent(reference)}`
);
// result.data.status → "success" | "failed" | "pending" | "reversed"GET /transfer/verify/:reference使用转账参考号验证转账状态。
typescript
const result = await paystackRequest(
`/transfer/verify/${encodeURIComponent(reference)}`
);
// result.data.status → "success" | "failed" | "pending" | "reversed"Transfer Flow
转账流程
typescript
// 1. Create recipient (see paystack-transfer-recipients skill)
// 2. Initiate transfer
const transfer = await paystackRequest("/transfer", {
method: "POST",
body: JSON.stringify({
source: "balance",
amount: 500000,
recipient: "RCP_gd9vgag7n5lr5ix",
reference: `txf_${crypto.randomUUID()}`,
}),
});
// 3. If OTP required, finalize
if (transfer.data.status === "otp") {
const otp = await getOTPFromUser();
await paystackRequest("/transfer/finalize_transfer", {
method: "POST",
body: JSON.stringify({
transfer_code: transfer.data.transfer_code,
otp,
}),
});
}
// 4. Listen for webhooks: transfer.success, transfer.failed, transfer.reversedtypescript
// 1. Create recipient (see paystack-transfer-recipients skill)
// 2. Initiate transfer
const transfer = await paystackRequest("/transfer", {
method: "POST",
body: JSON.stringify({
source: "balance",
amount: 500000,
recipient: "RCP_gd9vgag7n5lr5ix",
reference: `txf_${crypto.randomUUID()}`,
}),
});
// 3. If OTP required, finalize
if (transfer.data.status === "otp") {
const otp = await getOTPFromUser();
await paystackRequest("/transfer/finalize_transfer", {
method: "POST",
body: JSON.stringify({
transfer_code: transfer.data.transfer_code,
otp,
}),
});
}
// 4. Listen for webhooks: transfer.success, transfer.failed, transfer.reversedImportant Notes
重要注意事项
- You can only transfer from — ensure your Paystack balance has sufficient funds
balance - Bulk transfers require OTP to be disabled (Dashboard → Settings → Preferences)
- Transfer references must be unique, 16-50 characters, lowercase with and
-only_ - For Kenya MPESA Paybill/Till, include in the transfer
account_reference - Always verify transfer status via webhook (,
transfer.success) rather than pollingtransfer.failed
- 你只能从转账——请确保你的Paystack余额有足够资金
balance - 批量转账需要禁用OTP(控制台 → 设置 → 偏好设置)
- 转账参考号必须唯一,长度为16-50字符,仅允许小写字母、和
-_ - 肯尼亚地区MPESA Paybill/Till转账需包含参数
account_reference - 请始终通过webhook(、
transfer.success)验证转账状态,而非轮询transfer.failed