> ## 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.

# Wave — Sénégal

> Intégrer Wave Sénégal avec l'API LigdiCash. Mode de validation : Redirection LigdiCash (page de paiement pré-filtrée).

## Identité

| Champ              | Valeur                                           |
| ------------------ | ------------------------------------------------ |
| Pays               | Sénégal                                          |
| Opérateur          | Wave Sénégal                                     |
| `operator_id`      | `39`                                             |
| `operator_name`    | `WAVE SENEGAL`                                   |
| Indicatif          | +221                                             |
| Format du numéro   | `221XXXXXXXXX` (sans `+` ni espaces)             |
| Endpoint           | `POST /pay/v01/straight/checkout-invoice/create` |
| Mode de validation | Redirection LigdiCash                            |

## Mode de validation : Redirection LigdiCash

Pour Wave Sénégal, l'intégration LigdiCash passe actuellement par une **page web LigdiCash dédiée**, plutôt que par un traitement direct via l'API. Le flux est le suivant :

1. Vous appelez `/pay/v01/straight/checkout-invoice/create` avec le numéro du client dans `customer` et `otp: ""`.
2. LigdiCash répond avec le `token` de transaction et un champ `response_text` qui contient **l'URL d'une page de paiement LigdiCash** où le numéro est prérempli et où seul Wave Sénégal est proposé.
3. Vous redirigez le navigateur du client vers cette URL.
4. Le client confirme le paiement depuis la page LigdiCash et le paiement procède selon le flux propre à l'opérateur.
5. LigdiCash vous notifie le résultat final via votre `callback_url`.

<Warning>
  Le préremplissage de `customer` avec le numéro du client est **obligatoire**. Sans `customer`, le filtrage par numéro ne fonctionne pas et la page de paiement n'affichera pas Wave Sénégal correctement.
</Warning>

<Note>
  Ce mode utilise bien l'endpoint `/straight/checkout-invoice/create` (payin sans redirection). Ne pas confondre avec le [payin avec redirection](/api-paiement/payin-redirect/introduction), qui utilise un endpoint distinct et expose une page de paiement multi-opérateurs.
</Note>

## UX recommandée

<Steps>
  <Step title="Collecter le numéro du client">
    Votre formulaire recueille le numéro de téléphone Wave Sénégal.
  </Step>

  <Step title="Soumettre la requête">
    Requête sur `POST /pay/v01/straight/checkout-invoice/create` avec `customer` rempli et `otp: ""`.
  </Step>

  <Step title="Récupérer l'URL de la page LigdiCash">
    Dans la réponse, le champ `response_text` contient l'URL de la page de paiement LigdiCash dédiée.
  </Step>

  <Step title="Rediriger le client">
    Redirigez le navigateur du client vers cette URL. La page affiche le numéro prérempli et Wave Sénégal pré-sélectionné.
  </Step>

  <Step title="Attendre le callback">
    Le résultat final arrive via votre `callback_url`. Affichez un état d'attente — ne vous fiez pas au retour navigateur.
  </Step>
</Steps>

## Exemple de requête

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://app.ligdicash.com/pay/v01/straight/checkout-invoice/create \
    -H "Apikey: {API_KEY}" \
    -H "Authorization: Bearer {API_TOKEN}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{
      "commande": {
        "invoice": {
          "items": [],
          "total_amount": 5000,
          "devise": "XOF",
          "description": "Abonnement Pro — Janvier 2025",
          "customer": "221770000000",
          "customer_firstname": "Aminata",
          "customer_lastname": "Diop",
          "customer_email": "aminata@exemple.com",
          "external_id": "",
          "otp": ""
        },
        "store": {
          "name": "MonApp",
          "website_url": "https://monapp.com"
        },
        "actions": {
          "cancel_url": "",
          "return_url": "",
          "callback_url": "https://monapp.com/api/callback/ligdicash"
        },
        "custom_data": {
          "transaction_id": "ORD-2025-00065"
        }
      }
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    "https://app.ligdicash.com/pay/v01/straight/checkout-invoice/create",
    {
      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: [],
            total_amount: 5000,
            devise: "XOF",
            description: "Abonnement Pro — Janvier 2025",
            customer: "221770000000",
            customer_firstname: "Aminata",
            customer_lastname: "Diop",
            customer_email: "aminata@exemple.com",
            external_id: "",
            otp: "",
          },
          store: { name: "MonApp", website_url: "https://monapp.com" },
          actions: {
            cancel_url: "",
            return_url: "",
            callback_url: "https://monapp.com/api/callback/ligdicash",
          },
          custom_data: { transaction_id: "ORD-2025-00065" },
        },
      }),
    }
  );

  const data = await response.json();
  // Redirigez le client vers la page de paiement LigdiCash
  window.location.href = data.response_text;
  ```

  ```php PHP theme={null}
  $payload = [
    "commande" => [
      "invoice" => [
        "items" => [],
        "total_amount" => 5000,
        "devise" => "XOF",
        "description" => "Abonnement Pro — Janvier 2025",
        "customer" => "221770000000",
        "customer_firstname" => "Aminata",
        "customer_lastname" => "Diop",
        "customer_email" => "aminata@exemple.com",
        "external_id" => "",
        "otp" => "",
      ],
      "store" => ["name" => "MonApp", "website_url" => "https://monapp.com"],
      "actions" => [
        "cancel_url" => "",
        "return_url" => "",
        "callback_url" => "https://monapp.com/api/callback/ligdicash",
      ],
      "custom_data" => ["transaction_id" => "ORD-2025-00065"],
    ],
  ];

  $ch = curl_init("https://app.ligdicash.com/pay/v01/straight/checkout-invoice/create");
  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);
  // Redirigez le client vers la page de paiement LigdiCash
  header("Location: " . $data["response_text"]);
  ```
</CodeGroup>

## Réponse attendue

```json theme={null}
{
  "response_code": "00",
  "token": "eyJ0eXAiOiJKV1Qi...",
  "response_text": "https://app.ligdicash.com/pay/.../checkout/...",
  "description": "",
  "custom_data": {
    "transaction_id": "ORD-2025-00065"
  },
  "wiki": "https://client.ligdicash.com/wiki/createInvoice"
}
```

Redirigez le client vers l'URL contenue dans `response_text`. La page de paiement n'affichera que Wave Sénégal avec le numéro prérempli.

<Warning>
  Stockez le `token` immédiatement après la création. Utilisez-le pour appeler `confirm` à la réception du callback — ne vous fiez pas au token présent dans le payload du callback.
</Warning>

## Limites

| Paramètre          | Valeur |
| ------------------ | ------ |
| Montant minimum    | --     |
| Montant maximum    | --     |
| Limite quotidienne | --     |

## Pages associées

* [Modes de validation — Redirection LigdiCash](/api-paiement/payin-sans-redirect/modes-validation) — détail du flux
* [Créer une transaction](/api-paiement/payin-sans-redirect/creer-transaction) — référence complète de l'endpoint
* [Vérifier le statut](/api-paiement/payin-sans-redirect/verifier-statut) — appeler `confirm` après le callback
