> For the complete documentation index, see [llms.txt](https://moneymie.gitbook.io/toga-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://moneymie.gitbook.io/toga-api/api-reference/payouts/create-a-payout.md).

# Create a payout

Initiate a payout to a bank or mobile money account.

Initiate payout by specifying the details of the beneficiary, wallet address and payout type. You can send a payout to over 80 countries. The recipient's details and the sender's details are very much dependent on the payout type. Let's look at the request body for the different payout types.

<details>

<summary>BANK TRANSFER payout</summary>

```json
{
  "rateId": "637367c165ff2378041a1517",
  "purpose": "test-not compulsory",
  "type": "BANK_TRANSFER",
  "recipient": {
    "bankCode": "920",
    "accountNumber": "0152835900",
    "firstName": "Daniel",
    "lastName": "Mends"
  },
   "senderDetails": {
    "city": "Ibadan",
    "state": "Oyo",
    "country": "NG",
    "firstName": "Daniel",
    "lastName": "Torkura",
    "msisdn": "2349079935431",
    "address": "1 Akobo, Abdulsalam street",
    "dob": "1999-03-12",
    "idType": "NATIONAL_ID",
    "idNumber": "85974939420"
  }
}
```

</details>

<details>

<summary>MOBILE MONEY payout</summary>

```json
{
  "rateId": "63622185d62f256c752cc6a0",
  "type": "MOBILE_MONEY",
  "recipient": {
    "msisdn": "233241603403",
    "firstName": "Nancy",
    "lastName": "Mends"
  },
  "senderDetails": {
    "firstName": "Daniella",
    "lastName": "Timothy",
    "state": "Lagos",
    "city": "Iyano",
    "country": "NG",
    "msisdn": "2349079935431",
    "postalCode": "98I987",
    "dob": "1999-03-12",
    "idType": "NATIONAL_ID",
    "idNumber": "85974939420"
  }
}
```

</details>

<details>

<summary>WIRE payout</summary>

```json
{
  "rateId": "63622d00d69f256c752cc6a5",
  "type": "WIRE",
   "recipient": {
    "wireType": "ABA",
    "routingNumber": "084196768",
    "accountNumber": "9908004393",
    "bankCountry": "US"
  },
   "senderDetails": {
    "address": "2 Underwood",
    "city": "Dallas",
    "state": "TX",
    "country": "US",
    "firstName": "Wakanda",
    "lastName": "Toga",
    "postalCode": "75015"
  }
}
```

</details>

## Create a payout endpoint

<mark style="color:green;">`POST`</mark> `https://sandbox.moneymie.com/api/v1/payout/transactions`

The API lets you initiate a payout by specifying the details of the beneficiary, payout type and destination currency.

Asides from specifying the beneficiary, payout type and wallet address, you will need to specify the rate id. The rate id can be gotten by calling the [generate rate endpoint](/toga-api/api-reference/rate/generate-a-rate.md) to specify the amount, country and currency you intend that will receive the payout. The endpoint will return a rate id, which you will pass into the create a payout endpoint.

Here's an example of what the request payload should look like.

#### Request Body

| Name                                            | Type   | Description                                                      |
| ----------------------------------------------- | ------ | ---------------------------------------------------------------- |
| payoutType<mark style="color:red;">\*</mark>    | String | The payout method you intend to use, e.g. MOBILE\_MONEY.         |
| rateId<mark style="color:red;">\*</mark>        | String | The rate id returned when you call the generate rate endpoint.   |
| walletAddress<mark style="color:red;">\*</mark> | String | The wallet address that is tied to your account.                 |
| recipient<mark style="color:red;">\*</mark>     | Object | Recipient details. This is based on the payout type selected.    |
| senderDetails<mark style="color:red;">\*</mark> | Object | Sender details                                                   |
| Purpose                                         | String | The purpose of the transaction. Required for all payouts to NGN. |

{% tabs %}
{% tab title="201: Created Payout Successfully initiated" %}

```json

  {
    "message": "SUCCESS",
    "data": {
        "id": "6377883cf0e06502fd27dd03",
        "rate": {
            "tokenSize": 2.7,
            "feeSize": {
                "crypto": 1.1621621621621623,
                "fiat": 860.0000000000001
            },
            "total": {
                "crypto": 3.86,
                "fiat": 2860.0
            },
            "countryCode": "NG",
            "currencyCode": "NGN",
            "address": "0x186ec148E9B17C1A09EB935124ad350D7bed507A",
            "token": "USDC",
            "paymentMethods": [
                "BANK_TRANSFER"
            ],
            "executed": true,
            "createdAt": "2022-11-18T13:11:20.492+0000",
            "updatedAt": "2022-11-18T13:27:25.026+0000",
            "rateId": "63778478f0e06502fd27dd02",
            "amount": 2000.0
        },
        "payoutType": "BANK_TRANSFER",
        "status": "PENDING",
        "recipient": {
            "bankCode": "044",
            "accountNumber": "0909996418",
            "firstName": "Daniel",
            "lastName": " Torkura"
        },
        "senderDetails": {
            "firstName": "Daniel",
            "lastName": "Torkura",
            "city": "Ibadan",
            "state": "OY",
            "country": "NG"
        },
        "createdAt": "2022-11-18T13:27:24.893+0000",
        "updatedAt": "2022-11-18T13:27:24.893+0000",
        "ref": "a58243b7-9321-4b6d-a0d4-78cfad129983"
    }
}
```

{% endtab %}

{% tab title="401: Unauthorized Wrong credentials" %}

```json
{
    Unauthorized
}
```

{% endtab %}

{% tab title="400: Bad Request Client error" %}

```json
{
  "code": "XXXX",
  "message": "Invalid rate"
}
```

{% endtab %}
{% endtabs %}
