> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yabetoopay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Disbursement

> Create a disbursement to transfer funds from your account to a customer's account.

## Endpoint

```bash theme={null}
POST https://pay.sandbox.yabetoopay.com/v1/disbursements   # Sandbox
POST https://pay.api.yabetoopay.com/v1/disbursements       # Production
```

## Authentication

Use your secret key in the `Authorization` header:

```bash theme={null}
Authorization: Bearer YOUR_SECRET_KEY
```

<Note>
  Secret key security: The secret key must be kept confidential and
  must never be exposed in the frontend or client code. It must only be used on
  the server side.
</Note>

## Request Body

| Parameter             | Type     | Required | Description                        |
| --------------------- | -------- | -------- | ---------------------------------- |
| `amount`              | `number` | Yes      | The amount to transfer             |
| `currency`            | `string` | Yes      | Currency code (e.g., `XAF`, `XOF`) |
| `first_name`          | `string` | Yes      | Customer's first name              |
| `last_name`           | `string` | Yes      | Customer's last name               |
| `payment_method_data` | `object` | Yes      | Payment method details             |

### payment\_method\_data structure

```json theme={null}
{
  "type": "momo",
  "momo": {
    "msisdn": "242066594471",
    "country": "CG",
    "operator_name": "mtn"
  }
}
```

| Field                | Description                                   |
| -------------------- | --------------------------------------------- |
| `type`               | Payment method type (`momo` for Mobile Money) |
| `momo.msisdn`        | Customer's phone number                       |
| `momo.country`       | Country code (e.g., `CG`, `CM`)               |
| `momo.operator_name` | Operator name (`mtn`, `airtel`)               |

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://pay.sandbox.yabetoopay.com/v1/disbursements \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer YOUR_SECRET_KEY" \
    -d '{
      "amount": 10000,
      "currency": "XAF",
      "first_name": "Jean",
      "last_name": "Dupont",
      "payment_method_data": {
        "type": "momo",
        "momo": {
          "msisdn": "242066594471",
          "country": "CG",
          "operator_name": "mtn"
        }
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  import Yabetoo from "@yabetoo/sdk-js";

  const yabetoo = new Yabetoo("YOUR_SECRET_KEY");

  const disbursement = await yabetoo.disbursements.create({
    amount: 10000,
    currency: "XAF",
    firstName: "Jean",
    lastName: "Dupont",
    paymentMethodData: {
      type: "momo",
      momo: {
        msisdn: "242066594471",
        country: "CG",
        operatorName: "mtn",
      },
    },
  });
  ```

  ```python Python theme={null}
  from yabetoo import Yabetoo
  from yabetoo.models.disbursement import CreateDisbursementRequest
  from yabetoo.models.payment import PaymentMethodData, MomoData

  yabetoo = Yabetoo("YOUR_SECRET_KEY")

  disbursement = yabetoo.disbursements.create(CreateDisbursementRequest(
      amount=10000,
      currency="XAF",
      first_name="Jean",
      last_name="Dupont",
      payment_method_data=PaymentMethodData(
          type="momo",
          momo=MomoData(
              msisdn="242066594471",
              country="CG",
              operator_name="mtn"
          )
      )
  ))
  ```

  ```php PHP theme={null}
  <?php
  require 'vendor/autoload.php';

  use Yabetoo\Yabetoo;

  $yabetoo = new Yabetoo("YOUR_SECRET_KEY");

  $disbursement = $yabetoo->disbursements->create([
      "amount" => 10000,
      "currency" => "XAF",
      "first_name" => "Jean",
      "last_name" => "Dupont",
      "payment_method_data" => [
          "type" => "momo",
          "momo" => [
              "msisdn" => "242066594471",
              "country" => "CG",
              "operator_name" => "mtn",
          ],
      ],
  ]);
  ```

  ```java Java theme={null}
  import com.yabetoo.Yabetoo;
  import com.yabetoo.YabetooConfig;
  import com.yabetoo.model.Disbursement;
  import com.yabetoo.request.DisbursementCreateRequest;

  YabetooConfig config = new YabetooConfig()
      .setApiKey("YOUR_SECRET_KEY");

  Yabetoo yabetoo = new Yabetoo(config);

  DisbursementCreateRequest request = DisbursementCreateRequest.builder()
      .amount(10000)
      .currency("XAF")
      .firstName("Jean")
      .lastName("Dupont")
      .paymentMethodData(
          DisbursementCreateRequest.PaymentMethodData.builder()
              .type("momo")
              .momo(
                  DisbursementCreateRequest.PaymentMethodData.Momo.builder()
                      .msisdn("242066594471")
                      .country("CG")
                      .operatorName("mtn")
                      .build()
              )
              .build()
      )
      .build();

  Disbursement disbursement = yabetoo.disbursements().create(request);
  ```
</CodeGroup>

## Response

### 200 OK

When the disbursement was successfully created, the API will return a 200 OK response.

The status of the disbursement is `processing` because the payment is still being processed and has not been executed yet.

```json theme={null}
{
  "amount": 10000,
  "currency": "xaf",
  "status": "processing",
  "firstName": "Jean",
  "lastName": "Dupont",
  "operatorName": "mtn",
  "country": "cg",
  "phone": "242066594471",
  "object": "disbursement",
  "type": 1,
  "shouldExecutedAt": "2025-03-18T09:24:57.555Z",
  "id": "wt_RMqehxy8NNi1ocJFG2SSAZMj81m6spo72vnZ",
  "createdAt": "2025-03-17T10:24:57.559+01:00",
  "updatedAt": "2025-03-17T10:24:57.559+01:00"
}
```

### Disbursement Status

| Status       | Description                         |
| ------------ | ----------------------------------- |
| `processing` | Being processed                     |
| `succeeded`  | Disbursement completed successfully |
| `failed`     | Disbursement failed                 |
| `canceled`   | Disbursement was canceled           |

### 400 Bad Request

```json theme={null}
{
  "errors": [
    {
      "rule": "required",
      "field": "currency",
      "message": "required validation failed"
    }
  ]
}
```

### 401 Unauthorized

```json theme={null}
{
  "message": "Unauthorized"
}
```

<Note>
  Disbursements are processed asynchronously. Use webhooks
  to track their status in real-time.
</Note>
