Skip to content

Transfer Control

The TransferControlResource allows you to manage settings for your transfers, including checking balances, fetching ledgers, and managing OTP requirements for transfers.

Check Balance

Fetch the available balance on your integration.

php

$balance = paystack()->transferControl()->checkBalance();

foreach ($balance['data'] as $currencyBalance) {
    echo "Currency: " . $currencyBalance['currency'] . "\n";
    echo "Balance: " . $currencyBalance['balance'] . "\n";
}

Fetch Balance Ledger

Fetch all pay-ins and pay-outs that occurred on your integration.

php
// List ledger entries
$ledger = paystack()->transferControl()->fetchLedger();

// Filter ledger
$filtered = paystack()->transferControl()->fetchLedger([
    'perPage' => 20,
    'page' => 1
]);

Resend OTP

Generates a new OTP and sends it to the business phone number. This is useful if you are performing a transfer that requires OTP validation and the initial OTP was not received.

php
$transferCode = 'TRF_vsyqdmlzble3uii';

$response = paystack()->transferControl()->resendOtp($transferCode, 'resend_otp');

Parameters

ParameterTypeRequiredDescription
transfer_codeStringYesThe code for the transfer.
reasonStringNoEither resend_otp or transfer. Defaults to resend_otp.

Disable OTP Request

Request to disable the OTP requirement for transfers. Paystack will send an OTP to the business phone to verify this request.

Note: Disabling OTP allows you to complete transfers programmatically without manual intervention.

php
$response = paystack()->transferControl()->disableOtpRequest();

Finalize Disable OTP

Finalize the request to disable OTP on your transfers using the OTP sent to your business phone.

php
$otp = '123456'; // OTP received on business phone

$response = paystack()->transferControl()->disableOtpFinalize($otp);

Enable OTP

Re-enable the OTP requirement for transfers.

php
$response = paystack()->transferControl()->enableOtp();

Use Cases

Monitoring Cash Flow

You can use the fetchLedger method to build a dashboard showing the inflow and outflow of funds in your Paystack integration.

php
$ledger = paystack()->transferControl()->fetchLedger();

foreach ($ledger['data'] as $entry) {
    $amount = $entry['amount'];
    $type = $entry['model_responsible']; // Transaction, Transfer, Refund, etc.
    $reason = $entry['reason'];
    
    // Process and display entry
}

Automating Payouts

If you need to automate payouts to vendors or partners, you likely want to disable OTPs so your script can run without human intervention.

  1. Call disableOtpRequest() to trigger an OTP to your phone.
  2. Receive the OTP.
  3. Call disableOtpFinalize($otp) to confirm.
  4. Now you can use the Transfer Resource to send money programmatically.

Released under the MIT License.