{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lexio-rent/json-schema/lexio-rent-payment-schema.json",
  "title": "Payment",
  "description": "Encaissement, caution ou remboursement d’une location.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lexio-rent-paiements-api-openapi.yml#/components/schemas/Payment",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Identifiant du paiement."
    },
    "rentalId": {
      "type": "string",
      "format": "uuid",
      "description": "Location du paiement."
    },
    "number": {
      "type": "string",
      "description": "Numéro comptable : séquence `PAY` (encaissement), `CAU` (caution) ou `REM` (remboursement) de l’organisation."
    },
    "type": {
      "type": "string",
      "enum": [
        "PAYMENT",
        "DEPOSIT",
        "REFUND"
      ],
      "description": "`PAYMENT` : encaissement ; `DEPOSIT` : caution ; `REFUND` : remboursement."
    },
    "amount": {
      "type": "number",
      "description": "Montant réellement encaissé, bloqué ou remboursé, dans `currency` ; positif, le sens est porté par `type`. Seul un mouvement de caution enregistré dans Lexio au retour (restitution ou retenue) est négatif."
    },
    "currency": {
      "type": "string",
      "enum": [
        "EUR",
        "XPF",
        "CHF",
        "CAD",
        "GBP",
        "USD",
        "XOF"
      ],
      "description": "Devise de la location."
    },
    "method": {
      "type": "string",
      "enum": [
        "CASH",
        "CREDIT_CARD",
        "TRANSFER",
        "CHECK",
        "PAYPAL",
        "SWIKLY",
        "STRIPE",
        "TYLLT",
        "MOBILE_MONEY",
        "OTHER",
        "SEPA_DEBIT"
      ],
      "description": "Moyen de paiement."
    },
    "status": {
      "type": "string",
      "enum": [
        "PENDING",
        "VALIDATED",
        "REFUSED",
        "CANCELLED"
      ],
      "description": "Statut de la transaction : seules les lignes `VALIDATED` comptent dans le solde de la location. `PENDING` : en attente (prélèvement SEPA en cours, remboursement à exécuter) ; `REFUSED` : prélèvement SEPA rejeté ; `CANCELLED` : opération abandonnée."
    },
    "isPreAuthorization": {
      "type": "boolean",
      "description": "true : empreinte de caution, montant bloqué sans être débité ; toujours false hors `DEPOSIT`."
    },
    "paidAt": {
      "type": "string",
      "format": "date-time",
      "description": "Date de l’opération ; pour un paiement Stripe, celle du PaymentIntent."
    },
    "createdAt": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "description": "Instant d’enregistrement ; null pour une ligne antérieure à cette information."
    },
    "providerReference": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 64
        },
        {
          "type": "null"
        }
      ],
      "description": "Référence de l’opérateur Mobile Money ; null pour les autres moyens."
    },
    "stripePaymentIntentId": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^pi_[A-Za-z0-9]+$"
        },
        {
          "type": "null"
        }
      ],
      "description": "PaymentIntent Stripe qui a réglé ce paiement ; null sinon."
    },
    "notes": {
      "description": "Libellé libre, sans longueur maximale en lecture (plus long que la limite d’entrée de l’API). Toujours null pour une clé partenaire.",
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "id",
    "rentalId",
    "number",
    "type",
    "amount",
    "currency",
    "method",
    "status",
    "isPreAuthorization",
    "paidAt",
    "createdAt",
    "providerReference",
    "stripePaymentIntentId",
    "notes"
  ]
}