{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "PaymentOutcome.json",
  "title": "payment.succeeded / payment.failed object",
  "description": "An online payment was verified with Paystack.",
  "type": "object",
  "properties": {
    "reference": {
      "type": "string",
      "description": "Payment reference."
    },
    "invoiceId": {
      "type": "integer",
      "format": "int32",
      "description": "The invoice."
    },
    "invoiceNumber": {
      "type": "string",
      "description": "The invoice number."
    },
    "channel": {
      "type": "string",
      "description": "The payment channel."
    },
    "succeeded": {
      "type": "boolean",
      "description": "true on payment.succeeded, false on payment.failed."
    },
    "problem": {
      "type": [
        "string",
        "null"
      ],
      "description": "Why the money didn't satisfy the invoice, as text, such as paid NGN 858,500.00, invoice requires NGN 860,000.00. null on success, and when Paystack itself declined the payment. Display it; don't parse it."
    }
  },
  "required": [
    "reference",
    "invoiceId",
    "invoiceNumber",
    "channel",
    "succeeded",
    "problem"
  ],
  "examples": [
    {
      "reference": "T12-MAX-2026-0042-K3P9QZ_1",
      "invoiceId": 5012,
      "invoiceNumber": "MAX-2026-0042",
      "channel": "paystack",
      "succeeded": true,
      "problem": null
    }
  ]
}
