The Recipient class provides methods for interacting with Paystack’s Transfer Recipient API. Transfer recipients are used to define the destination for payouts and transfers.
Overview
The Recipient class allows you to:
- Create single or bulk transfer recipients
- List and retrieve recipient details
- Update recipient information
- Delete recipients
Methods
create
Creates a new transfer recipient.
async create(input: RecipientCreateInput): Promise<RecipientCreateResponse>
type
'nuban' | 'ghipss' | 'mobile_money'
required
The type of recipient
The recipient’s account number
The recipient’s bank code
A description for the recipient
currency
'NGN' | 'USD' | 'GHS' | 'ZAR' | 'KES' | 'XOF'
Currency for the recipient (defaults to NGN)
Authorization code for the recipient
Additional metadata for the recipient
Whether the recipient is active
The unique recipient code starting with RCP_
The recipient type (nuban, ghipss, or mobile_money)
The resolved account name
Example:
const { data, error } = await paystack.recipient.create({
type: "nuban",
name: "John Doe",
account_number: "0123456789",
bank_code: "058",
currency: "NGN"
});
if (data) {
console.log(data.data.recipient_code);
}
createBulk
Creates multiple transfer recipients in bulk.
async createBulk(input: RecipientBulkCreateInput): Promise<RecipientBulkCreateResponse>
Array of recipient objects, each containing the same fields as the create method
Array of successfully created recipients
Array of errors for recipients that failed to create
Example:
const { data, error } = await paystack.recipient.createBulk({
batch: [
{
type: "nuban",
name: "John Doe",
account_number: "0123456789",
bank_code: "058"
},
{
type: "nuban",
name: "Jane Smith",
account_number: "0987654321",
bank_code: "058"
}
]
});
if (data) {
console.log(`Created ${data.data.success.length} recipients`);
}
list
Lists transfer recipients.
async list(input: GenericInput): Promise<RecipientListResponse>
Number of records per page (1-100, defaults to 50)
Page number (defaults to 1)
ISO datetime to filter from
ISO datetime to filter to
Array of recipient objectsThe unique recipient code
Whether the recipient is active
Pagination metadata including total, page, perPage, and pageCount
Example:
const { data, error } = await paystack.recipient.list({
perPage: 20,
page: 1
});
if (data) {
console.log(`Total recipients: ${data.meta?.total}`);
}
getRecipientById
Retrieves a single transfer recipient by ID or code.
async getRecipientById(id_or_code: string): Promise<RecipientSingleResponse>
The ID or code of the recipient
The unique recipient code
The recipient description
Whether the recipient is active
Bank details including account_number, account_name, bank_code, and bank_name
Example:
const { data, error } = await paystack.recipient.getRecipientById("RCP_abc123");
if (data) {
console.log(data.data.name);
}
update
Updates a transfer recipient.
async update(input: RecipientUpdateInput): Promise<GenericResponse>
The ID or code of the recipient to update
The new name for the recipient
The new email for the recipient
Example:
const { data, error } = await paystack.recipient.update({
id_or_code: "RCP_abc123",
name: "John Updated",
email: "john@example.com"
});
if (data) {
console.log(data.message);
}
delete
Deletes a transfer recipient.
async delete(id_or_code: string): Promise<GenericResponse>
The ID or code of the recipient to delete
Example:
const { data, error } = await paystack.recipient.delete("RCP_abc123");
if (data) {
console.log(data.message);
}