{
 "openapi": "3.1.0",
 "info": {
  "title": "API de paiement Warilo",
  "version": "1.0.0",
  "description": "Encaissez par Mobile Money et carte bancaire avec une seule intégration : paiements, liens et QR codes, remboursements, solde et webhooks signés.",
  "x-en": "Collect payments by Mobile Money and card with a single integration: payments, links and QR codes, refunds, balance and signed webhooks."
 },
 "servers": [
  {
   "url": "https://api.warilo.com",
   "description": "Production et test (selon la clé utilisée)",
   "x-en-description": "Production and test (depending on the key used)"
  }
 ],
 "security": [
  {
   "bearer": []
  }
 ],
 "tags": [
  {
   "name": "Paiements",
   "description": "Création, suivi et liste des paiements.",
   "x-en": "Creating, tracking and listing payments."
  },
  {
   "name": "Liens",
   "description": "Liens de paiement et QR codes.",
   "x-en": "Payment links and QR codes."
  },
  {
   "name": "Remboursements",
   "description": "Remboursements totaux ou partiels.",
   "x-en": "Full or partial refunds."
  },
  {
   "name": "Compte",
   "description": "Solde et état du service.",
   "x-en": "Balance and service status."
  },
  {
   "name": "Sandbox",
   "description": "Outils réservés aux clés de test.",
   "x-en": "Tools for test keys only."
  }
 ],
 "paths": {
  "/v1/payments": {
   "post": {
    "tags": [
     "Paiements"
    ],
    "operationId": "createPayment",
    "summary": "Créer un paiement",
    "x-en-summary": "Create a payment",
    "description": "Crée un paiement et renvoie son identifiant. En Mobile Money, une demande d'autorisation (USSD) est envoyée au client ; en carte, checkout_url redirige vers la page de paiement sécurisée. Le statut final arrive par webhook ou avec GET /v1/payments/{id}.",
    "x-en": "Creates a payment and returns its identifier. With Mobile Money, an authorisation request (USSD) is sent to the customer; with card, checkout_url redirects to the secure payment page. The final status arrives by webhook or with GET /v1/payments/{id}.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/NewPayment"
       },
       "examples": {
        "mobile_money": {
         "value": {
          "amount": 12000,
          "currency": "EUR",
          "method": "mobile_money",
          "operator": "orange_money",
          "customer": {
           "phone": "+237673713115",
           "name": "Awa Ngo"
          },
          "description": "Frais de scolarité, 1er trimestre",
          "callback_url": "https://votre-site.com/webhooks/warilo"
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Paiement créé, en attente d'autorisation",
      "x-en": "Payment created, awaiting authorisation",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Payment"
        },
        "example": {
         "id": "pay_3f2a9c0d1e4b5a6f7c8d",
         "object": "payment",
         "status": "pending",
         "amount": 12000,
         "currency": "EUR",
         "method": "mobile_money",
         "operator": "orange_money",
         "customer": {
          "phone": "+237673713115",
          "name": "Awa Ngo"
         },
         "description": "Frais de scolarité, 1er trimestre",
         "checkout_url": null,
         "refunded_amount": 0,
         "failure_code": null,
         "livemode": false,
         "created_at": "2026-10-28T09:15:00Z",
         "expires_at": "2026-10-28T09:20:00Z"
        }
       }
      }
     },
     "422": {
      "description": "Paramètres invalides",
      "x-en": "Invalid parameters",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ErrorBody"
        }
       }
      }
     },
     "429": {
      "description": "Trop de requêtes",
      "x-en": "Too many requests",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ErrorBody"
        }
       }
      }
     }
    }
   },
   "get": {
    "tags": [
     "Paiements"
    ],
    "operationId": "listPayments",
    "summary": "Lister les paiements",
    "x-en-summary": "List payments",
    "description": "Renvoie les paiements du compte, du plus récent au plus ancien. Pagination par curseur avec next_cursor.",
    "x-en": "Returns the account's payments, newest first. Cursor pagination with next_cursor.",
    "parameters": [
     {
      "name": "limit",
      "in": "query",
      "description": "Nombre de paiements par page (1 à 100, 20 par défaut).",
      "x-en": "Payments per page (1 to 100, 20 by default).",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 100,
       "default": 20
      }
     },
     {
      "name": "status",
      "in": "query",
      "description": "Filtre par statut.",
      "x-en": "Filter by status.",
      "schema": {
       "type": "string",
       "enum": [
        "pending",
        "requires_action",
        "processing",
        "succeeded",
        "failed",
        "expired",
        "refunded",
        "partially_refunded"
       ]
      }
     },
     {
      "name": "from",
      "in": "query",
      "description": "Date de début (ISO 8601).",
      "x-en": "Start date (ISO 8601).",
      "schema": {
       "type": "string",
       "format": "date-time"
      }
     },
     {
      "name": "to",
      "in": "query",
      "description": "Date de fin (ISO 8601).",
      "x-en": "End date (ISO 8601).",
      "schema": {
       "type": "string",
       "format": "date-time"
      }
     },
     {
      "name": "cursor",
      "in": "query",
      "description": "Curseur renvoyé par la page précédente.",
      "x-en": "Cursor returned by the previous page.",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Liste des paiements",
      "x-en": "List of payments",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PaymentList"
        },
        "example": {
         "data": [
          {
           "id": "pay_3f2a9c0d1e4b5a6f7c8d",
           "object": "payment",
           "status": "succeeded",
           "amount": 12000,
           "currency": "EUR",
           "method": "mobile_money",
           "operator": "orange_money",
           "created_at": "2026-10-28T09:15:00Z"
          },
          {
           "id": "pay_9b8c7d6e5f4a3b2c1d0e",
           "object": "payment",
           "status": "refunded",
           "amount": 4500,
           "currency": "EUR",
           "method": "card",
           "operator": null,
           "created_at": "2026-10-27T16:40:00Z"
          }
         ],
         "next_cursor": "pay_9b8c7d6e5f4a3b2c1d0e"
        }
       }
      }
     }
    }
   }
  },
  "/v1/payments/{id}": {
   "get": {
    "tags": [
     "Paiements"
    ],
    "operationId": "getPayment",
    "summary": "Consulter un paiement",
    "x-en-summary": "Retrieve a payment",
    "description": "Renvoie l'état courant du paiement. Interrogez-le après requires_action et en secours des webhooks.",
    "x-en": "Returns the payment's current state. Poll it after requires_action and as a fallback to webhooks.",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "description": "Identifiant du paiement (pay_…).",
      "x-en": "Payment identifier (pay_…).",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Paiement",
      "x-en": "Payment",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Payment"
        },
        "example": {
         "id": "pay_3f2a9c0d1e4b5a6f7c8d",
         "object": "payment",
         "status": "succeeded",
         "amount": 12000,
         "currency": "EUR",
         "method": "mobile_money",
         "operator": "orange_money",
         "customer": {
          "phone": "+237673713115",
          "name": "Awa Ngo"
         },
         "description": "Frais de scolarité, 1er trimestre",
         "checkout_url": null,
         "refunded_amount": 0,
         "failure_code": null,
         "livemode": false,
         "created_at": "2026-10-28T09:15:00Z",
         "expires_at": "2026-10-28T09:20:00Z"
        }
       }
      }
     },
     "404": {
      "description": "Paiement introuvable",
      "x-en": "Payment not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ErrorBody"
        }
       }
      }
     }
    }
   }
  },
  "/v1/payments/{id}/refund": {
   "post": {
    "tags": [
     "Remboursements"
    ],
    "operationId": "refundPayment",
    "summary": "Rembourser un paiement",
    "x-en-summary": "Refund a payment",
    "description": "Rembourse tout ou partie d'un paiement réussi. Sans amount, le remboursement est total. Plusieurs remboursements partiels sont possibles dans la limite du montant encaissé.",
    "x-en": "Refunds all or part of a succeeded payment. Without amount, the refund is full. Several partial refunds are possible up to the collected amount.",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "description": "Identifiant du paiement (pay_…).",
      "x-en": "Payment identifier (pay_…).",
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/NewRefund"
       },
       "examples": {
        "partial": {
         "value": {
          "amount": 2500,
          "reason": "article_retourne"
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Remboursement créé",
      "x-en": "Refund created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Refund"
        },
        "example": {
         "id": "ref_5d4c3b2a1f0e9d8c7b6a",
         "object": "refund",
         "payment_id": "pay_3f2a9c0d1e4b5a6f7c8d",
         "amount": 2500,
         "status": "processing",
         "reason": "article_retourne",
         "created_at": "2026-10-28T10:02:00Z"
        }
       }
      }
     },
     "409": {
      "description": "Paiement non remboursable dans cet état",
      "x-en": "Payment not refundable in this state",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ErrorBody"
        }
       }
      }
     },
     "422": {
      "description": "Montant supérieur au solde remboursable",
      "x-en": "Amount above the refundable balance",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ErrorBody"
        }
       }
      }
     }
    }
   }
  },
  "/v1/links": {
   "post": {
    "tags": [
     "Liens"
    ],
    "operationId": "createLink",
    "summary": "Créer un lien de paiement",
    "x-en-summary": "Create a payment link",
    "description": "Crée une page de paiement partageable (WhatsApp, SMS, QR code). Sans amount, le lien est à montant libre : le client saisit le montant.",
    "x-en": "Creates a shareable payment page (WhatsApp, SMS, QR code). Without amount, the link is open-amount: the customer enters the amount.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/NewLink"
       },
       "examples": {
        "fixed": {
         "value": {
          "amount": 4500,
          "currency": "EUR",
          "description": "Commande n°1042",
          "expires_at": "2026-11-04T23:59:59Z"
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Lien créé",
      "x-en": "Link created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Link"
        },
        "example": {
         "id": "lnk_9b2c3d4e5f6a7b8c9d0e",
         "object": "link",
         "status": "active",
         "url": "https://pay.warilo.com/l/lnk_9b2c3d4e5f6a7b8c9d0e",
         "qr_url": "https://pay.warilo.com/l/lnk_9b2c3d4e5f6a7b8c9d0e/qr.svg",
         "amount": 4500,
         "currency": "EUR",
         "description": "Commande n°1042",
         "payment_id": null,
         "created_at": "2026-10-28T11:20:00Z",
         "expires_at": "2026-11-04T23:59:59Z"
        }
       }
      }
     },
     "422": {
      "description": "Paramètres invalides",
      "x-en": "Invalid parameters",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ErrorBody"
        }
       }
      }
     }
    }
   }
  },
  "/v1/links/{id}": {
   "get": {
    "tags": [
     "Liens"
    ],
    "operationId": "getLink",
    "summary": "Consulter un lien",
    "x-en-summary": "Retrieve a link",
    "description": "Renvoie l'état du lien : active, paid, expired ou closed. payment_id renseigne le paiement une fois le lien payé.",
    "x-en": "Returns the link state: active, paid, expired or closed. payment_id gives the payment once the link is paid.",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "description": "Identifiant du lien (lnk_…).",
      "x-en": "Link identifier (lnk_…).",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Lien",
      "x-en": "Link",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Link"
        },
        "example": {
         "id": "lnk_9b2c3d4e5f6a7b8c9d0e",
         "object": "link",
         "status": "paid",
         "url": "https://pay.warilo.com/l/lnk_9b2c3d4e5f6a7b8c9d0e",
         "qr_url": "https://pay.warilo.com/l/lnk_9b2c3d4e5f6a7b8c9d0e/qr.svg",
         "amount": 4500,
         "currency": "EUR",
         "description": "Commande n°1042",
         "payment_id": "pay_1a2b3c4d5e6f7a8b9c0d",
         "created_at": "2026-10-28T11:20:00Z",
         "expires_at": "2026-11-04T23:59:59Z"
        }
       }
      }
     },
     "404": {
      "description": "Lien introuvable",
      "x-en": "Link not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ErrorBody"
        }
       }
      }
     }
    }
   }
  },
  "/v1/links/{id}/close": {
   "post": {
    "tags": [
     "Liens"
    ],
    "operationId": "closeLink",
    "summary": "Fermer un lien",
    "x-en-summary": "Close a link",
    "description": "Désactive un lien actif : la page de paiement n'accepte plus de paiement. Les liens payés ne peuvent pas être fermés.",
    "x-en": "Disables an active link: the payment page no longer accepts payments. Paid links cannot be closed.",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "description": "Identifiant du lien (lnk_…).",
      "x-en": "Link identifier (lnk_…).",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Lien fermé",
      "x-en": "Link closed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Link"
        },
        "example": {
         "id": "lnk_9b2c3d4e5f6a7b8c9d0e",
         "object": "link",
         "status": "closed",
         "url": "https://pay.warilo.com/l/lnk_9b2c3d4e5f6a7b8c9d0e",
         "qr_url": "https://pay.warilo.com/l/lnk_9b2c3d4e5f6a7b8c9d0e/qr.svg",
         "amount": 4500,
         "currency": "EUR",
         "description": "Commande n°1042",
         "payment_id": null,
         "created_at": "2026-10-28T11:20:00Z",
         "expires_at": "2026-11-04T23:59:59Z"
        }
       }
      }
     },
     "409": {
      "description": "Lien déjà payé ou fermé",
      "x-en": "Link already paid or closed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ErrorBody"
        }
       }
      }
     }
    }
   }
  },
  "/v1/balance": {
   "get": {
    "tags": [
     "Compte"
    ],
    "operationId": "getBalance",
    "summary": "Consulter le solde",
    "x-en-summary": "Retrieve the balance",
    "description": "Solde disponible (versements possibles) et en attente (paiements en cours), par devise.",
    "x-en": "Available balance (payouts possible) and pending balance (payments in progress), per currency.",
    "responses": {
     "200": {
      "description": "Solde du compte",
      "x-en": "Account balance",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Balance"
        },
        "example": {
         "object": "balance",
         "available": [
          {
           "currency": "EUR",
           "amount": 184250
          },
          {
           "currency": "USD",
           "amount": 32000
          },
          {
           "currency": "XOF",
           "amount": 750000
          }
         ],
         "pending": [
          {
           "currency": "EUR",
           "amount": 4500
          }
         ]
        }
       }
      }
     }
    }
   }
  },
  "/v1/health": {
   "get": {
    "tags": [
     "Compte"
    ],
    "operationId": "health",
    "summary": "État du service",
    "x-en-summary": "Service status",
    "description": "Vérification de disponibilité, sans authentification.",
    "x-en": "Availability check, without authentication.",
    "security": [],
    "responses": {
     "200": {
      "description": "Service disponible",
      "x-en": "Service available",
      "content": {
       "application/json": {
        "example": {
         "status": "ok",
         "version": "1.0.0"
        }
       }
      }
     }
    }
   }
  },
  "/v1/sandbox/payments/{id}/confirm": {
   "post": {
    "tags": [
     "Sandbox"
    ],
    "operationId": "sandboxConfirmPayment",
    "summary": "Simuler l'issue d'un paiement",
    "x-en-summary": "Simulate a payment outcome",
    "description": "Réservé aux clés de test : force le paiement à réussir ou à échouer, et déclenche le webhook correspondant. Aucun mouvement d'argent réel.",
    "x-en": "Test keys only: forces the payment to succeed or fail, and triggers the matching webhook. No real money moves.",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "description": "Identifiant du paiement (pay_…).",
      "x-en": "Payment identifier (pay_…).",
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SandboxConfirm"
       },
       "examples": {
        "succeeded": {
         "value": {
          "outcome": "succeeded"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Paiement mis à jour",
      "x-en": "Payment updated",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Payment"
        },
        "example": {
         "id": "pay_3f2a9c0d1e4b5a6f7c8d",
         "object": "payment",
         "status": "succeeded",
         "amount": 12000,
         "currency": "EUR",
         "method": "mobile_money",
         "operator": "orange_money",
         "customer": {
          "phone": "+237673713115",
          "name": "Awa Ngo"
         },
         "description": "Frais de scolarité, 1er trimestre",
         "checkout_url": null,
         "refunded_amount": 0,
         "failure_code": null,
         "livemode": false,
         "created_at": "2026-10-28T09:15:00Z",
         "expires_at": "2026-10-28T09:20:00Z"
        }
       }
      }
     },
     "403": {
      "description": "Réservé aux clés de test",
      "x-en": "Test keys only",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ErrorBody"
        }
       }
      }
     }
    }
   }
  }
 },
 "webhooks": {
  "paymentSucceeded": {
   "post": {
    "summary": "payment.succeeded",
    "description": "Paiement encaissé. Vérifiez la signature Warilo-Signature avant de traiter l'événement.",
    "x-en": "Payment collected. Verify the Warilo-Signature header before processing the event.",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/Event"
       }
      }
     }
    }
   }
  },
  "paymentFailed": {
   "post": {
    "summary": "payment.failed",
    "description": "Paiement refusé, annulé ou expiré ; failure_code précise la cause.",
    "x-en": "Payment declined, cancelled or expired; failure_code gives the cause.",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/Event"
       }
      }
     }
    }
   }
  },
  "refundSucceeded": {
   "post": {
    "summary": "refund.succeeded",
    "description": "Remboursement exécuté.",
    "x-en": "Refund completed.",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/Event"
       }
      }
     }
    }
   }
  },
  "linkPaid": {
   "post": {
    "summary": "link.paid",
    "description": "Lien de paiement payé ; data.link contient le lien et son payment_id.",
    "x-en": "Payment link paid; data.link contains the link and its payment_id.",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/Event"
       }
      }
     }
    }
   }
  }
 },
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer",
    "bearerFormat": "wk_test_… ou wk_live_…",
    "description": "Clé de test ou live, dans l'en-tête Authorization.",
    "x-en": "Test or live key, in the Authorization header."
   }
  },
  "schemas": {
   "NewPayment": {
    "type": "object",
    "required": [
     "amount",
     "currency",
     "method",
     "customer"
    ],
    "properties": {
     "amount": {
      "type": "integer",
      "minimum": 100,
      "description": "Montant en unité mineure : centimes pour EUR et USD, francs pour XOF.",
      "x-en": "Amount in minor units: cents for EUR and USD, francs for XOF."
     },
     "currency": {
      "type": "string",
      "enum": [
       "EUR",
       "USD",
       "XOF"
      ],
      "description": "Devise du paiement.",
      "x-en": "Payment currency."
     },
     "method": {
      "type": "string",
      "enum": [
       "mobile_money",
       "card"
      ],
      "description": "Moyen de paiement.",
      "x-en": "Payment method."
     },
     "operator": {
      "type": "string",
      "enum": [
       "orange_money",
       "mtn_momo",
       "moov_money",
       "wave"
      ],
      "description": "Opérateur Mobile Money ; obligatoire avec method mobile_money.",
      "x-en": "Mobile Money operator; required with method mobile_money."
     },
     "customer": {
      "$ref": "#/components/schemas/Customer"
     },
     "description": {
      "type": "string",
      "maxLength": 200,
      "description": "Libellé visible sur le reçu et dans la console.",
      "x-en": "Label shown on the receipt and in the console."
     },
     "callback_url": {
      "type": "string",
      "format": "uri",
      "description": "Adresse https à appeler pour ce paiement uniquement (en plus du webhook du compte).",
      "x-en": "https address to call for this payment only (in addition to the account webhook)."
     },
     "metadata": {
      "type": "object",
      "additionalProperties": {
       "type": "string"
      },
      "description": "Jusqu'à 20 paires clé-valeur conservées avec le paiement.",
      "x-en": "Up to 20 key-value pairs stored with the payment."
     }
    }
   },
   "Customer": {
    "type": "object",
    "required": [
     "phone"
    ],
    "properties": {
     "phone": {
      "type": "string",
      "description": "Numéro au format international E.164, sans espace.",
      "x-en": "Phone number in international E.164 format, without spaces."
     },
     "name": {
      "type": "string",
      "description": "Nom du payeur, repris sur le reçu.",
      "x-en": "Payer name, shown on the receipt."
     },
     "email": {
      "type": "string",
      "format": "email",
      "description": "Adresse e-mail pour envoyer le reçu.",
      "x-en": "Email address to send the receipt to."
     }
    }
   },
   "Payment": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "description": "Identifiant du paiement (pay_…).",
      "x-en": "Payment identifier (pay_…)."
     },
     "object": {
      "type": "string",
      "enum": [
       "payment"
      ]
     },
     "status": {
      "type": "string",
      "enum": [
       "pending",
       "requires_action",
       "processing",
       "succeeded",
       "failed",
       "expired",
       "refunded",
       "partially_refunded"
      ],
      "description": "État courant du paiement.",
      "x-en": "Current payment state."
     },
     "amount": {
      "type": "integer",
      "description": "Montant en unité mineure.",
      "x-en": "Amount in minor units."
     },
     "currency": {
      "type": "string",
      "enum": [
       "EUR",
       "USD",
       "XOF"
      ]
     },
     "method": {
      "type": "string",
      "enum": [
       "mobile_money",
       "card"
      ]
     },
     "operator": {
      "type": [
       "string",
       "null"
      ],
      "description": "Opérateur Mobile Money, ou null.",
      "x-en": "Mobile Money operator, or null."
     },
     "customer": {
      "$ref": "#/components/schemas/Customer"
     },
     "description": {
      "type": "string"
     },
     "checkout_url": {
      "type": [
       "string",
       "null"
      ],
      "description": "Page de paiement pour les cartes (redirect), ou null.",
      "x-en": "Payment page for cards (redirect), or null."
     },
     "refunded_amount": {
      "type": "integer",
      "description": "Montant déjà remboursé, en unité mineure.",
      "x-en": "Amount already refunded, in minor units."
     },
     "failure_code": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       null,
       "declined",
       "insufficient_funds",
       "invalid_number",
       "not_on_whatsapp",
       "timeout",
       "cancelled"
      ],
      "description": "Cause de l'échec, ou null.",
      "x-en": "Failure cause, or null."
     },
     "livemode": {
      "type": "boolean",
      "description": "false en mode test.",
      "x-en": "false in test mode."
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "Au-delà, le paiement passe à expired.",
      "x-en": "After this, the payment becomes expired."
     }
    }
   },
   "PaymentList": {
    "type": "object",
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Payment"
      }
     },
     "next_cursor": {
      "type": [
       "string",
       "null"
      ],
      "description": "Curseur de la page suivante, ou null.",
      "x-en": "Cursor for the next page, or null."
     }
    }
   },
   "NewRefund": {
    "type": "object",
    "properties": {
     "amount": {
      "type": "integer",
      "description": "Montant à rembourser en unité mineure ; omis, remboursement total.",
      "x-en": "Amount to refund in minor units; omitted, full refund."
     },
     "reason": {
      "type": "string",
      "enum": [
       "article_retourne",
       "double_paiement",
       "fraude",
       "demande_client"
      ],
      "description": "Motif du remboursement.",
      "x-en": "Refund reason."
     }
    }
   },
   "Refund": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "description": "Identifiant du remboursement (ref_…).",
      "x-en": "Refund identifier (ref_…)."
     },
     "object": {
      "type": "string",
      "enum": [
       "refund"
      ]
     },
     "payment_id": {
      "type": "string"
     },
     "amount": {
      "type": "integer"
     },
     "status": {
      "type": "string",
      "enum": [
       "processing",
       "succeeded",
       "failed"
      ],
      "description": "État du remboursement.",
      "x-en": "Refund state."
     },
     "reason": {
      "type": "string"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "NewLink": {
    "type": "object",
    "required": [
     "currency",
     "description"
    ],
    "properties": {
     "amount": {
      "type": "integer",
      "description": "Montant en unité mineure ; omis, le client choisit le montant.",
      "x-en": "Amount in minor units; omitted, the customer chooses the amount."
     },
     "currency": {
      "type": "string",
      "enum": [
       "EUR",
       "USD",
       "XOF"
      ]
     },
     "description": {
      "type": "string",
      "maxLength": 200,
      "description": "Objet du lien, affiché sur la page de paiement.",
      "x-en": "Link purpose, shown on the payment page."
     },
     "expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "Date d'expiration du lien.",
      "x-en": "Link expiry date."
     },
     "callback_url": {
      "type": "string",
      "format": "uri",
      "description": "Adresse https appelée quand le lien est payé.",
      "x-en": "https address called when the link is paid."
     }
    }
   },
   "Link": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "description": "Identifiant du lien (lnk_…).",
      "x-en": "Link identifier (lnk_…)."
     },
     "object": {
      "type": "string",
      "enum": [
       "link"
      ]
     },
     "status": {
      "type": "string",
      "enum": [
       "active",
       "paid",
       "expired",
       "closed"
      ],
      "description": "État du lien.",
      "x-en": "Link state."
     },
     "url": {
      "type": "string",
      "format": "uri",
      "description": "Adresse de la page de paiement, à partager.",
      "x-en": "Payment page address, to share."
     },
     "qr_url": {
      "type": "string",
      "format": "uri",
      "description": "QR code du lien, en SVG.",
      "x-en": "QR code for the link, as SVG."
     },
     "amount": {
      "type": [
       "integer",
       "null"
      ]
     },
     "currency": {
      "type": "string",
      "enum": [
       "EUR",
       "USD",
       "XOF"
      ]
     },
     "description": {
      "type": "string"
     },
     "payment_id": {
      "type": [
       "string",
       "null"
      ],
      "description": "Paiement associé une fois le lien payé.",
      "x-en": "Payment linked once the link is paid."
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "expires_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "Balance": {
    "type": "object",
    "properties": {
     "object": {
      "type": "string",
      "enum": [
       "balance"
      ]
     },
     "available": {
      "type": "array",
      "description": "Montants disponibles par devise.",
      "x-en": "Available amounts per currency.",
      "items": {
       "$ref": "#/components/schemas/Money"
      }
     },
     "pending": {
      "type": "array",
      "description": "Montants en attente par devise.",
      "x-en": "Pending amounts per currency.",
      "items": {
       "$ref": "#/components/schemas/Money"
      }
     }
    }
   },
   "Money": {
    "type": "object",
    "properties": {
     "currency": {
      "type": "string",
      "enum": [
       "EUR",
       "USD",
       "XOF"
      ]
     },
     "amount": {
      "type": "integer",
      "description": "Montant en unité mineure.",
      "x-en": "Amount in minor units."
     }
    }
   },
   "SandboxConfirm": {
    "type": "object",
    "required": [
     "outcome"
    ],
    "properties": {
     "outcome": {
      "type": "string",
      "enum": [
       "succeeded",
       "failed"
      ],
      "description": "Issue à simuler.",
      "x-en": "Outcome to simulate."
     },
     "failure_code": {
      "type": "string",
      "enum": [
       "declined",
       "insufficient_funds",
       "timeout",
       "cancelled"
      ],
      "description": "Cause de l'échec, avec outcome failed.",
      "x-en": "Failure cause, with outcome failed."
     }
    }
   },
   "Event": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "description": "Identifiant de l'événement (evt_…), aussi dans Warilo-Event-Id.",
      "x-en": "Event identifier (evt_…), also in Warilo-Event-Id."
     },
     "object": {
      "type": "string",
      "enum": [
       "event"
      ]
     },
     "type": {
      "type": "string",
      "enum": [
       "payment.succeeded",
       "payment.failed",
       "refund.succeeded",
       "link.paid"
      ]
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "data": {
      "type": "object",
      "description": "Objet concerné : payment, refund ou link.",
      "x-en": "Related object: payment, refund or link."
     }
    },
    "example": {
     "id": "evt_7a8b9c0d1e2f3a4b5c6d",
     "object": "event",
     "type": "payment.succeeded",
     "created_at": "2026-10-28T09:16:12Z",
     "data": {
      "payment": {
       "id": "pay_3f2a9c0d1e4b5a6f7c8d",
       "object": "payment",
       "status": "succeeded",
       "amount": 12000,
       "currency": "EUR",
       "method": "mobile_money",
       "operator": "orange_money",
       "livemode": false,
       "created_at": "2026-10-28T09:15:00Z"
      }
     }
    }
   },
   "ErrorBody": {
    "type": "object",
    "properties": {
     "error": {
      "type": "object",
      "properties": {
       "code": {
        "type": "string"
       },
       "message": {
        "type": "string"
       }
      }
     },
     "request_id": {
      "type": "string",
      "description": "Identifiant de la requête, à citer au support.",
      "x-en": "Request identifier, to quote to support."
     }
    },
    "example": {
     "error": {
      "code": "invalid_amount",
      "message": "amount must be at least 100 (minor units)"
     },
     "request_id": "req_8f7e6d5c4b3a"
    }
   }
  }
 }
}
