# Transfer approval

> Approve transfers with OTP, turn OTP off for automated payouts, and confirm each transfer with your own approval URL.

Paystack can hold a transfer until it's approved, so an exposed API key or a mistaken server action doesn't immediately turn into a payout. You can approve transfers in two ways:

1. **OTP**: Paystack sends a one-time password to the business owner, who enters it to release the transfer.
2. **Approval URL**: Paystack sends each transfer to an endpoint on your server, which approves or rejects it automatically.

OTP needs a person for every transfer, so it doesn't fit automated payouts such as payroll or vendor settlements. Disable OTP before you use [bulk transfers](/disbursements/transfers/bulk-transfers). If you still want an approval step after you disable OTP, use an [approval URL](#server-approval).

## OTP approval

As an additional layer of security, a Paystack business owner might want to confirm a transfer by using the One Time Password (OTP) sent to their
device.

If you have [OTP enabled on your Paystack Dashboard](https://support.paystack.com/hc/en-us/articles/360009973339-Can-I-receive-an-OTP-to-authorise-my-transfers-) and you [initiate a transfer](/disbursements/transfers/single-transfers#initiate-a-transfer) via the API, you get a response with `message: Transfer requires OTP to continue` and `data.status: otp`

<localized-snippet src="disbursements/transfers/initiate-otp-response">



</localized-snippet>

When the business owner supplies the OTP sent to their mobile number (and email if enabled), the transfer can be completed by using our <api-link path="/transfer#finalize" title="Finalize Transfer">



</api-link>

 endpoint:

<localized-request-response src="disbursements/transfers/finalize">



</localized-request-response>

If the OTP isn't used within 30 minutes, the transfer is marked `abandoned`. If you rely on OTP, turn on both the email and phone channels to improve delivery.

## Disable OTP

Turn OTP off when your server initiates transfers without a person in the loop. You can do this from the Dashboard or with the API.

<callout type="warning">

Disabling OTP removes the manual check before money leaves your balance. Only do it when your transfer initiation flow is secured with strong secret management, access control, and audit logging, and consider adding an [approval URL](#server-approval).

</callout>

### From the Dashboard

Go to [Developers → Transfer approvals](https://dashboard.paystack.com/v2/developers/transfer-approvals) on the Paystack Dashboard and uncheck **Confirm transfers before sending**:

![Image of the disabled OTP state of transfers](images/disabled_otp.png)

### With the API

Turning OTP off is itself protected by OTP, so it takes two calls:

1. Call <api-link path="/transfer#disableOtp" title="Disable OTP">



</api-link>

. Paystack sends an OTP to the business owner.
2. Call <api-link path="/transfer#disableOtpFinalize" title="Finalize Disable OTP">



</api-link>

 with that OTP to complete the change.

To turn OTP back on, call <api-link path="/transfer#enableOtp" title="Enable OTP">



</api-link>

. Transfers you initiate afterwards require OTP approval again.

## Server approval

OTP approval doesn’t allow you to build a fully automated system. However, this shouldn’t prevent you from confirming the authenticity of transfer requests. This is where the server approval comes in. It allows you to create a URL that checks that a transfer request was initiated by you. It’s a two step process:

1. Create an approval URL
2. Add URL to dashboard

### Create an approval URL

The approval URL is a `POST` endpoint that checks the authenticity of transfer details. If the transfer details are authentic, it should respond with a `200`, else a `400`:

<table>
<thead>
  <tr>
    <th>
      Response code
    </th>
    
    <th>
      Meaning
    </th>
    
    <th>
      Status
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        200
      </strong>
    </td>
    
    <td>
      Transfer approved
    </td>
    
    <td>
      <code>
        pending
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        400
      </strong>
    </td>
    
    <td>
      Transfer rejected
    </td>
    
    <td>
      <code>
        rejected
      </code>
    </td>
  </tr>
</tbody>
</table>

If the merchant server doesn’t respond within a few seconds, we mark the transfer as `blocked` and stop further processing.

<callout type="warning" title="Avoid long-running task">

You should ensure your approval URL isn’t running long processes. This could lead to a delay in response time that causes transfers to get blocked.

</callout>

<code-tabs :labels="{"js":"Node","php":"PHP"}">
<template v-slot:js="">

```javascript
// Using Express
function validateTransferRequest(request) {
  // validation logic
}

app.post("/approval", (req, res) => {
  const { body } = req;
  const isValidTransferRequest = validateTransferRequest(body);

  if (!isValidTransferRequest) {
    return res.status(400).json({});
  }

  return res.status(200).json({});
});
```

</template>

<template v-slot:php="">

```php
<?php
function validateTransferRequest($request)
{
  // validation logic goes here
  return false; // update line based on logic
}

// Retrieve the request's body and parse it as JSON
$input = @file_get_contents("php://input");
$payload = json_decode($input);
$isValidTransferRequest = validateTransferRequest($payload);

if (!$isValidTransferRequest) {
  return http_response_code(400);
}

return http_response_code(200);
?>
```

</template>
</code-tabs>

We add the payload used to initiate the transfer request when we send an approval request. When validating a request, your validation logic should confirm that the transfer **reference** and **amount** from the payload matches what you have on your system.

## Add URL to dashboard

When you are done with the implementation of your approval URL, you need to add the URL to the Paystack Dashboard. To do this, go to [Developers → Transfer approvals](https://dashboard.paystack.com/v2/developers/transfer-approvals) on the Paystack Dashboard:

![Image of the dashboard section to add the approval URL](images/transfer_approval.png)

<callout type="info" title="Save changes">

Don’t forget to hit the **Save changes** button to finalize the setup process.

</callout>

In the Transfer Approval section, check the box for the domain you want to activate the approval for, then add the URL for the domain. There are two actions available when you reject a request:

1. **Blacklist Recipient**: When you blacklist a recipient, you would no longer be able to send money to the recipient. You can undo this from the Dashboard by [navigating to the Transfer recipients page](https://dashboard.paystack.com/v2/transfer-recipients), clicking on the recipient and toggling the switch.
2. **Do Nothing**: We just won’t continue processing the request.
