# Transfers

```
STAGING_URL: https://switchapi3.azurewebsites.net
LIVE_URL: https://switchapi.azurewebsites.net
```

## Bank list

<mark style="color:blue;">`GET`</mark> `https://switchapi3.azurewebsites.net/user/transfer/banks`

Return all banks with their bank codes

#### Headers

| Name          | Type   | Description                                                              |
| ------------- | ------ | ------------------------------------------------------------------------ |
| Authorization | string | The format for this is ***Authorization*** is ***Bearer token\_string*** |

{% tabs %}
{% tab title="200 " %}

```
{
    "message": "Banks retrieved successfully",
    "data": [
        {
            "name": "Access Bank",
            "code": "044"
        },
        {
            "name": "Access Bank (Diamond)",
            "code": "063"
        },
        {
            "name": "ALAT by WEMA",
            "code": "035A"
        },
        {
            "name": "ASO Savings and Loans",
            "code": "401"
        },
        {
            "name": "Citibank Nigeria",
            "code": "023"
        },
        {
            "name": "Ecobank Nigeria",
            "code": "050"
        },
        {
            "name": "Ekondo Microfinance Bank",
            "code": "562"
        },
        {
            "name": "Enterprise Bank",
            "code": "084"
        },
        {
            "name": "Fidelity Bank",
            "code": "070"
        },
        {
            "name": "First Bank of Nigeria",
            "code": "011"
        },
        {
            "name": "First City Monument Bank",
            "code": "214"
        },
        {
            "name": "Guaranty Trust Bank",
            "code": "058"
        },
        {
            "name": "Heritage Bank",
            "code": "030"
        },
        {
            "name": "Jaiz Bank",
            "code": "301"
        },
        {
            "name": "Keystone Bank",
            "code": "082"
        },
        {
            "name": "MainStreet Bank",
            "code": "014"
        },
        {
            "name": "Parallex Bank",
            "code": "526"
        },
        {
            "name": "Polaris Bank",
            "code": "076"
        },
        {
            "name": "Providus Bank",
            "code": "101"
        },
        {
            "name": "Stanbic IBTC Bank",
            "code": "221"
        },
        {
            "name": "Standard Chartered Bank",
            "code": "068"
        },
        {
            "name": "Sterling Bank",
            "code": "232"
        },
        {
            "name": "Suntrust Bank",
            "code": "100"
        },
        {
            "name": "Union Bank of Nigeria",
            "code": "032"
        },
        {
            "name": "United Bank For Africa",
            "code": "033"
        },
        {
            "name": "Unity Bank",
            "code": "215"
        },
        {
            "name": "Wema Bank",
            "code": "035"
        },
        {
            "name": "Zenith Bank",
            "code": "057"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Transfer Recipients List

<mark style="color:blue;">`GET`</mark> `https://switchapi3.azurewebsites.net/user/transfer/recipients`

Retrieves all recipients saved by user for easy transfer. It takes a `transfer_type`value of `internal`, `external` or `all` and defaults to `all` if `transfer_type` parameter is not passed.

#### Query Parameters

| Name           | Type   | Description                                                      |
| -------------- | ------ | ---------------------------------------------------------------- |
| transfer\_type | string | **internal**, **external**, or **all**. Default value is **all** |

#### Headers

| Name          | Type   | Description                                                           |
| ------------- | ------ | --------------------------------------------------------------------- |
| Authorization | string | The format for this ***Authorization*** is ***Bearer token\_string*** |

{% tabs %}
{% tab title="200 " %}

```
{
    "message": "Transfer recipients retrieved successfully",
    "data": [
        {
            "id": 1,
            "account_name": "OLAOLUWA AYOTUNDE OLURO",
            "account_number": "0069702289",
            "bank_name": "Sterling Bank",
            "bank_code": "232"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Resolve Transfer Recipient

<mark style="color:green;">`POST`</mark> `https://switchapi3.azurewebsites.net/user/transfer/resolve_recipient`

This returns a recipient for an ***internal*** or ***external*** transfer

#### Headers

| Name          | Type   | Description                                                           |
| ------------- | ------ | --------------------------------------------------------------------- |
| Authorization | string | The format for this ***Authorization*** is ***Bearer token\_string*** |

#### Request Body

| Name                   | Type   | Description                                                                                        |
| ---------------------- | ------ | -------------------------------------------------------------------------------------------------- |
| transfer\_amount\_kobo | string | Required when transfer\_type is ***external***                                                     |
| bank\_code             | string | Required when transfer is ***external***                                                           |
| account\_number        | string | Required when transfer is ***external***                                                           |
| recipient\_slug        | string | Required when transfer is ***internal.*** The recipient's email or switch\_id                      |
| transfer\_type         | string | Type of transfer a recipient resolution is being done for. Either ***internal*** or ***external*** |

{% tabs %}
{% tab title="200 " %}

```
# EXTERNAL TRANSFER RESOLVE RECIPIENT
{
    "message": "Transfer recipient resolve successful",
    "data": {
        "transfer_type": "external",
        "transfer_request_id": 6,
        "account_name": "OLAOLUWA AYOTUNDE OLURO",
        "bank_code": "232",
        "account_number": "0069702289",
        "transfer_charge": "0.0",
        "transfer_charge_vat": "0.0"
    }
}



# INTERNAL TRANSFER RESOLVE RECIPIENT
{
    "message": "Transfer recipient resolve successful",
    "data": {
        "transfer_type": "internal",
        "transfer_request_id": 8,
        "account_name": "OLAOLUWA OLURO",
        "bank_code": null,
        "account_number": "2",
        "transfer_charge": null,
        "transfer_charge_vat": null
    }
}
```

{% endtab %}
{% endtabs %}

## External Transfer \[Switch to Bank]

<mark style="color:green;">`POST`</mark> `https://switch-api-staging.herokuapp.com/user/wallet/transfer/external`

This call initiates a transfer out of a user's bank account to another bank account.\
\
Note: You either pass the ***transfer\_recipient\_id*** along with the amount or you pass the ***transfer\_request\_id*** along with the amount. The ***transfer\_request\_id*** can be gotten from the ***resolve\_recipient \["external"]*** endpoint\
\
This call needs to be authenticated by either ***pin*** or ***otp***

#### Headers

| Name        | Type   | Description                                                         |
| ----------- | ------ | ------------------------------------------------------------------- |
| auth\_token | string | The format for this ***auth\_token*** is ***Bearer token\_string*** |

#### Request Body

| Name                    | Type    | Description                                                               |
| ----------------------- | ------- | ------------------------------------------------------------------------- |
| otp                     | string  | Authenticate transaction                                                  |
| pin                     | string  | Authenticate transaction                                                  |
| remark                  | string  | Any notes the user wishes to pass along with the transfer                 |
| save\_recipient         | boolean | This saves the recipient to the user's recipients list. Default is false. |
| transfer\_recipient\_id | string  | id of a transfer recipient gotten from user's recipients list             |
| transfer\_request\_id   | string  | Transfer request id gotten from **resolve\_recipient**                    |
| transfer\_amount\_kobo  | string  | Amount to be transferred                                                  |

{% tabs %}
{% tab title="200 " %}

```
{
    "message": "Transfer successful"
}
```

{% endtab %}
{% endtabs %}

## Internal Transfer \[Switch to Switch]

<mark style="color:green;">`POST`</mark> `https://switchapi3.azurewebsites.net/user/transfer/internal`

This call initiates a transfer from one Switch user to another using the platform.\
\
Note: You either pass the ***transfer\_request\_id*** along with other information or you pass the ***transfer\_recipient\_id*** along with the amount. The ***transfer\_request\_id*** can be gotten from the ***resolve\_recipient\["internal"]*** endpoint.\
\
This call needs to be authenticated by either ***pin*** or ***otp***

#### Headers

| Name          | Type   | Description                                                           |
| ------------- | ------ | --------------------------------------------------------------------- |
| Authorization | string | The format for this ***Authorization*** is ***Bearer token\_string*** |

#### Request Body

| Name                    | Type    | Description                                                               |
| ----------------------- | ------- | ------------------------------------------------------------------------- |
| source                  | string  | ***wallet*** or ***account***.                                            |
| otp                     | string  | Authenticate transaction                                                  |
| pin                     | string  | Authenticate transaction                                                  |
| remark                  | string  | Any notes the user wishes to pass along with the transfer                 |
| save\_recipient         | boolean | This saves the recipient to the user's recipients list. Default is false. |
| transfer\_recipient\_id | string  | id of a transfer recipient gotten from a user's recipients list           |
| transfer\_request\_id   | string  | Transfer request id gotten from ***resolve\_recipient***                  |
| transfer\_amount\_kobo  | string  | Amount to be transferred                                                  |

{% tabs %}
{% tab title="200 " %}

```
{
    "message": "Transfer successful"
}
```

{% endtab %}
{% endtabs %}

## Self-transfer

<mark style="color:green;">`POST`</mark> `https://switchapi3.azurewebsites.net/user/transfer/self`

This endpoint transfers money from the user's wallet to account and vice-versa.

#### Headers

| Name           | Type   | Description                                                 |
| -------------- | ------ | ----------------------------------------------------------- |
| Authentication | string | The format for Authentication is ***Bearer token\_string*** |

#### Request Body

| Name         | Type   | Description               |
| ------------ | ------ | ------------------------- |
| source       | string | Either wallet or account. |
| destination  | string | Either wallet or account. |
| amount\_kobo | string | The amount in kobo.       |

{% tabs %}
{% tab title="200 " %}

```
{
  "message": "Transfer successful"
}
```

{% endtab %}

{% tab title="400 " %}

```
{
  "message": "source must be different from destination"
}
```

{% endtab %}
{% endtabs %}

## Delete beneficiary

<mark style="color:red;">`DELETE`</mark> `https://switchapi3.azurewebsites.net/user/transfer/beneficiary/:id`

This endpoint deletes a user's saved beneficiary.

#### Path Parameters

| Name | Type   | Description           |
| ---- | ------ | --------------------- |
| id   | string | The beneficiary's id. |

#### Headers

| Name          | Type   | Description                  |
| ------------- | ------ | ---------------------------- |
| Authorization | string | Format is ***Bearer token*** |

{% tabs %}
{% tab title="200 " %}

```
{
  "message": "Beneficiary deleted successfully"
}
```

{% endtab %}

{% tab title="400 " %}

```
{
  "message": "Beneficiary does not belong to this user"
}
```

{% endtab %}
{% endtabs %}
