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

# LigdiCash Wallet

> Integrate payment via the LigdiCash wallet. Validation mode: SMS OTP. Two dedicated endpoints: /v02/debitotp and /v02/debitwallet/withotp.

## Identity

| Field           | Value                                            |
| --------------- | ------------------------------------------------ |
| Operator        | LigdiCash Wallet                                 |
| `operator_id`   | -                                                |
| `operator_name` | LIGDICASH \[OPERATOR\_NAME]                      |
| Number format   | `country code` + local number (no `+` or spaces) |
| Validation mode | SMS OTP                                          |

<Note>
  The LigdiCash Wallet uses two endpoints distinct from the other operators (`/v02`). The flow is different: a first call triggers the OTP being sent, a second call submits the transaction with the OTP.
</Note>

## Validation mode: SMS OTP

The customer receives an OTP code on their LigdiCash app or by SMS after your first request. They share this code with you. You then submit a second request with the OTP to finalize the transaction.

## Recommended UX

<Steps>
  <Step title="Collect the customer's number">
    Your form collects the phone number associated with the customer's LigdiCash account.
  </Step>

  <Step title="Send the OTP — first request">
    Call `GET /pay/v02/debitotp/{phone_number}/{amount}`. LigdiCash sends an OTP to the customer.
  </Step>

  <Step title="Display the OTP field">
    After confirmation that the OTP was sent (`"error": false`), display an input field for the OTP. Tell the customer to check their LigdiCash app or SMS messages.
  </Step>

  <Step title="Submit with the OTP — second request">
    Call `POST /pay/v02/debitwallet/withotp` with the number in `customer` and the OTP in `otp`.
  </Step>

  <Step title="Wait for the callback">
    Show a waiting indicator. Confirmation arrives via your `callback_url`.
  </Step>
</Steps>

## Step 1 — Send the OTP

```
GET https://app.ligdicash.com/pay/v02/debitotp/{phone_number}/{amount}
```

The `phone_number` and `amount` parameters are **path parameters**, not a JSON body.

### Headers

<ParamField header="Apikey" type="string" required>
  The API key of your LigdiCash project.
</ParamField>

<ParamField header="Authorization" type="string" required>
  Your API TOKEN prefixed with `Bearer `.
</ParamField>

<ParamField header="Accept" type="string" required>
  Must be `application/json`.
</ParamField>

### Path parameters

<ParamField path="phone_number" type="string" required>
  Customer's phone number in the format `country code` + local number, without `+` or spaces.
</ParamField>

<ParamField path="amount" type="integer" required>
  Amount in XOF (integer, no decimals).
</ParamField>

### Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://app.ligdicash.com/pay/v02/debitotp/22670000000/5000" \
    -H "Apikey: {API_KEY}" \
    -H "Authorization: Bearer {API_TOKEN}" \
    -H "Accept: application/json"
  ```

  ```javascript Node.js theme={null}
  const phone = "22670000000";
  const amount = 5000;

  const response = await fetch(
    `https://app.ligdicash.com/pay/v02/debitotp/${phone}/${amount}`,
    {
      method: "GET",
      headers: {
        Apikey: process.env.LIGDICASH_API_KEY,
        Authorization: `Bearer ${process.env.LIGDICASH_API_TOKEN}`,
        Accept: "application/json",
      },
    }
  );

  const data = await response.json();
  ```

  ```php PHP theme={null}
  $phone = "22670000000";
  $amount = 5000;

  $ch = curl_init("https://app.ligdicash.com/pay/v02/debitotp/{$phone}/{$amount}");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Apikey: " . $_ENV["LIGDICASH_API_KEY"],
    "Authorization: Bearer " . $_ENV["LIGDICASH_API_TOKEN"],
    "Accept: application/json",
  ]);

  $data = json_decode(curl_exec($ch), true);
  curl_close($ch);
  ```
</CodeGroup>

### Response

```json Success theme={null}
{
  "error": false,
  "message": "OTP sent. Please check your phone."
}
```

<Warning>
  Check that `error` is `false` before displaying the OTP field. If `error` is `true`, show an error message and do not offer OTP input.
</Warning>

***

## Step 2 — Validate with the OTP

```
POST https://app.ligdicash.com/pay/v02/debitwallet/withotp
```

### Headers

<ParamField header="Apikey" type="string" required>
  The API key of your LigdiCash project.
</ParamField>

<ParamField header="Authorization" type="string" required>
  Your API TOKEN prefixed with `Bearer `.
</ParamField>

<ParamField header="Accept" type="string" required>
  Must be `application/json`.
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Must be `application/json`.
</ParamField>

### Body

Same structure as the `/pay/v01/straight/checkout-invoice/create` endpoint, with `customer` filled and `otp` containing the code received by the customer.

### Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://app.ligdicash.com/pay/v02/debitwallet/withotp \
    -H "Apikey: {API_KEY}" \
    -H "Authorization: Bearer {API_TOKEN}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{
      "commande": {
        "invoice": {
          "items": [
            {
              "name": "Pro Subscription",
              "description": "Premium access for 1 month",
              "quantity": 1,
              "unit_price": 5000,
              "total_price": 5000
            }
          ],
          "total_amount": 5000,
          "devise": "XOF",
          "description": "Pro Subscription — January 2025",
          "customer": "22670000000",
          "customer_firstname": "Amadou",
          "customer_lastname": "Diallo",
          "customer_email": "amadou@example.com",
          "external_id": "",
          "otp": "123456"
        },
        "store": {
          "name": "MyApp",
          "website_url": "https://myapp.com"
        },
        "actions": {
          "cancel_url": "",
          "return_url": "",
          "callback_url": "https://myapp.com/api/callback/ligdicash"
        },
        "custom_data": {
          "transaction_id": "ORD-2025-00042"
        }
      }
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    "https://app.ligdicash.com/pay/v02/debitwallet/withotp",
    {
      method: "POST",
      headers: {
        Apikey: process.env.LIGDICASH_API_KEY,
        Authorization: `Bearer ${process.env.LIGDICASH_API_TOKEN}`,
        Accept: "application/json",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        commande: {
          invoice: {
            items: [
              {
                name: "Pro Subscription",
                description: "Premium access for 1 month",
                quantity: 1,
                unit_price: 5000,
                total_price: 5000,
              },
            ],
            total_amount: 5000,
            devise: "XOF",
            description: "Pro Subscription — January 2025",
            customer: "22670000000",
            customer_firstname: "Amadou",
            customer_lastname: "Diallo",
            customer_email: "amadou@example.com",
            external_id: "",
            otp: "123456",
          },
          store: { name: "MyApp", website_url: "https://myapp.com" },
          actions: {
            cancel_url: "",
            return_url: "",
            callback_url: "https://myapp.com/api/callback/ligdicash",
          },
          custom_data: { transaction_id: "ORD-2025-00042" },
        },
      }),
    }
  );

  const data = await response.json();
  ```

  ```php PHP theme={null}
  $payload = [
    "commande" => [
      "invoice" => [
        "items" => [[
          "name" => "Pro Subscription",
          "description" => "Premium access for 1 month",
          "quantity" => 1,
          "unit_price" => 5000,
          "total_price" => 5000,
        ]],
        "total_amount" => 5000,
        "devise" => "XOF",
        "description" => "Pro Subscription — January 2025",
        "customer" => "22670000000",
        "customer_firstname" => "Amadou",
        "customer_lastname" => "Diallo",
        "customer_email" => "amadou@example.com",
        "external_id" => "",
        "otp" => "123456",
      ],
      "store" => ["name" => "MyApp", "website_url" => "https://myapp.com"],
      "actions" => [
        "cancel_url" => "",
        "return_url" => "",
        "callback_url" => "https://myapp.com/api/callback/ligdicash",
      ],
      "custom_data" => ["transaction_id" => "ORD-2025-00042"],
    ],
  ];

  $ch = curl_init("https://app.ligdicash.com/pay/v02/debitwallet/withotp");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Apikey: " . $_ENV["LIGDICASH_API_KEY"],
    "Authorization: Bearer " . $_ENV["LIGDICASH_API_TOKEN"],
    "Accept: application/json",
    "Content-Type: application/json",
  ]);

  $data = json_decode(curl_exec($ch), true);
  curl_close($ch);
  ```
</CodeGroup>

### Expected response

<CodeGroup>
  ```json Success theme={null}
  {
    "response_code": "00",
    "token": "eyJ0eXAiOiJKV1Qi...",
    "response_text": "Votre requête est en cours de traitement",
    "wiki": "https://client.ligdicash.com/wiki/createInvoice"
  }
  ```

  ```json Failure theme={null}
  {
    "response_code": "01",
    "token": "",
    "response_text": "Echec (Code00)",
    "wiki": "https://client.ligdicash.com/wiki/createInvoice"
  }
  ```
</CodeGroup>

<Warning>
  Store the `token` returned by `/debitwallet/withotp`. This is the one you will use to call `confirm` when the callback is received.
</Warning>

## Limits

| Parameter      | Value         |
| -------------- | ------------- |
| Minimum amount | 10 XOF        |
| Maximum amount | 2,000,000 XOF |
| Daily limit    | --            |

## Related pages

* [Validation modes — SMS OTP](/en/payment-api/direct-payin/validation-modes) — details of the two-request flow
* [Verify the status](/en/payment-api/direct-payin/verify-status) — call `confirm` after the callback
