πŸ“š Resources
πŸ‘₯ Beneficiaries

Beneficiaries API

The Beneficiaries API allows you to create and manage payment recipients. Beneficiaries are required for withdrawals, transfers, and exchanges where funds need to be sent to external accounts.

Create Beneficiary

Create a new beneficiary for receiving payments. The required fields vary depending on the currency and country.

Endpoint

POST /api/v1/client/beneficiaries

Authentication

This endpoint requires HMAC authentication (Business API Key). Include your API key and signature in the request headers:

x-api-key: <your-api-key>
x-timestamp: <RFC3339-timestamp>
x-signature: <HMAC-signature>

Request Body

FieldTypeRequiredDescriptionExample
first_namestringYesBeneficiary's first name"John"
last_namestringYesBeneficiary's last name"Doe"
emailstringYesBeneficiary's email address"john.doe@example.com"
phonestringYesBeneficiary's phone number"+1234567890"
bank_namestringYesName of the bank"Access Bank"
account_numberstringConditionalBank account number (required for NGN)"0123456789"
bank_codestringNoBank code (from banks API)"044"
country_codestringYesISO 3166-1 alpha-2 country code"NG", "US", "CA"
currency_codestringYesCurrency code for the beneficiary"NGN", "USD", "CAD"
account_namestringNoAccount holder name (auto-generated if not provided)"John Doe"
ibanstringNoIBAN for SEPA transfers"GB82WEST12345698765432"
bic_swift_codestringNoBIC/SWIFT code for international transfers"CHASUS33"
recipient_addressstringNoPhysical address of the recipient"123 Main St, Lagos"
notesstringNoAdditional notes about the beneficiary"Monthly salary payment"
routing_numberstringNoRouting number (US/Canada)"021000021"
account_typestringNoAccount type"Checking", "Savings"
payment_methodstringNoPayment method/rail"ACH", "Wire", "Sepa"
addressobjectNoStructured address objectSee Address Object below

Address Object (Optional)

{
  "street": "123 Main Street",
  "city": "Lagos",
  "state": "Lagos State",
  "postal_code": "100001",
  "country": "NG"
}

Currency-Specific Requirements

NGN (Nigerian Naira)

  • account_number is required
  • bank_code is recommended (use from Banks API)
  • bank_name is required

USD (US Dollar)

  • payment_method is required (ACH, Wire, or Sepa)
  • For ACH: routing_number and account_number are required
  • For Wire: routing_number, account_number, and bic_swift_code are required
  • account_type is recommended (Checking or Savings)

Other Currencies

  • Requirements vary by country
  • Check specific country requirements in the Banks API documentation

Success Response (201 Created)

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "user_id": "660e8400-e29b-41d4-a716-446655440001",
  "first_name": "John",
  "last_name": "Doe",
  "email": "john.doe@example.com",
  "phone": "+1234567890",
  "bank_name": "Access Bank",
  "account_number": "0123456789",
  "bank_code": "044",
  "country_code": "NG",
  "currency_code": "NGN",
  "status": "pending",
  "is_verified": false,
  "account_name": "John Doe",
  "is_internal": false,
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

Error Responses

Status CodeDescription
400Bad Request - Missing required fields, invalid data, or validation errors
401Unauthorized - Invalid or missing API credentials
409Conflict - Beneficiary already exists
500Internal Server Error

Example Request

curl -X POST https://api.transfaar.com/api/v1/client/beneficiaries \
  -H "Content-Type: application/json" \
  -H "x-api-key: tf_test_biz_your_api_key" \
  -H "x-timestamp: 2024-01-15T10:30:00Z" \
  -H "x-signature: your_hmac_signature" \
  -d '{
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe@example.com",
    "phone": "+2348012345678",
    "bank_name": "Access Bank",
    "account_number": "0123456789",
    "bank_code": "044",
    "country_code": "NG",
    "currency_code": "NGN"
  }'

Example: JavaScript/Node.js

const crypto = require('crypto');
 
async function createBeneficiary(apiKey, secretKey, beneficiaryData) {
  const timestamp = new Date().toISOString();
  const body = JSON.stringify(beneficiaryData);
  const dataToSign = body + '|' + timestamp;
  
  const signature = crypto
    .createHmac('sha256', secretKey)
    .update(dataToSign)
    .digest('hex');
 
  const response = await fetch('https://api.transfaar.com/api/v1/client/beneficiaries', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': apiKey,
      'x-timestamp': timestamp,
      'x-signature': signature
    },
    body: body
  });
 
  return await response.json();
}
 
// Usage
const beneficiary = await createBeneficiary(
  'your-api-key',
  'your-secret-key',
  {
    first_name: 'John',
    last_name: 'Doe',
    email: 'john.doe@example.com',
    phone: '+2348012345678',
    bank_name: 'Access Bank',
    account_number: '0123456789',
    bank_code: '044',
    country_code: 'NG',
    currency_code: 'NGN'
  }
);

List Beneficiaries

Retrieve a paginated list of beneficiaries for the authenticated business.

Endpoint

GET /api/v1/client/beneficiaries

Query Parameters

ParameterTypeDescriptionExample
page_idintegerPage number (default: 1)1
page_sizeintegerNumber of items per page (default: 10)20
currencystringFilter by currency code"NGN", "USD"
countrystringFilter by country code"NG", "US"
namestringSearch by beneficiary name"John"
use_tagbooleanFilter for internal tag beneficiariestrue, false

Success Response (200 OK)

{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "first_name": "John",
      "last_name": "Doe",
      "email": "john.doe@example.com",
      "bank_name": "Access Bank",
      "country_code": "NG",
      "currency_code": "NGN",
      "status": "verified",
      "is_verified": true
    }
  ],
  "pagination": {
    "page_id": 1,
    "page_size": 10,
    "total": 25,
    "total_pages": 3
  }
}

Get Beneficiary

Retrieve details of a specific beneficiary by ID.

Endpoint

GET /api/v1/client/beneficiaries/{id}

Path Parameters

ParameterTypeDescription
idUUIDBeneficiary ID

Success Response (200 OK)

Returns the full beneficiary object with all details.


Update Beneficiary

Update an existing beneficiary's information.

Endpoint

PATCH /api/v1/client/beneficiaries/{id}

Request Body

Same structure as create beneficiary, but all fields are optional. Only provided fields will be updated.


Delete Beneficiary

Delete a beneficiary. Beneficiaries that are associated with active transactions cannot be deleted.

Endpoint

DELETE /api/v1/client/beneficiaries/{id}

Success Response (200 OK)

{
  "message": "Beneficiary deleted successfully"
}

Related Endpoints


Best Practices

  1. Use Bank IDs - When creating beneficiaries, use the bank_code from the Banks API for better reliability
  2. Validate Accounts - Use the account lookup endpoint to verify account numbers before creating beneficiaries
  3. Handle Verification - Beneficiaries start with status: "pending" and may require verification depending on currency and amount
  4. Store Beneficiary IDs - Save the beneficiary id returned from create for use in quote/transaction requests