{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/payments-ai/json-schema/payments-ai-public-api-transaction-detail-response-schema.json",
  "title": "PublicApiTransactionDetailResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/payments-ai-transactions-api-openapi.yml#/components/schemas/PublicApiTransactionDetailResponse",
  "type": "object",
  "required": [
    "id",
    "transactionId",
    "date",
    "orderId",
    "method",
    "amountIsProvisional",
    "breakdown",
    "history"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Canonical merchant-facing transaction id (internal UUID v7)."
    },
    "transactionId": {
      "type": "string",
      "description": "Deprecated Whop payment id (`pay_…`). Removed on 2027-01-15.",
      "deprecated": true
    },
    "date": {
      "type": "string",
      "format": "date-time"
    },
    "status": {
      "type": "string"
    },
    "result": {
      "type": "string"
    },
    "customerId": {
      "type": "string"
    },
    "orderId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Order this payment paid for; `null` when the payment is not tied to an order."
    },
    "method": {
      "$ref": "#/$defs/PublicApiTransactionMethod"
    },
    "amountIsProvisional": {
      "type": "boolean",
      "description": "True while `breakdown.gross` is provisional: the payment provider sent a refund event before the payment's success event, without the sale total or currency, so the amount is a lower bound or the currency a placeholder. Becomes `false` when the payment succeeds and its final amount replaces the provisional one. `remainingRefundable` is computed from the provisional amount, so it can be lower than the real remaining amount, never higher."
    },
    "breakdown": {
      "$ref": "#/$defs/PublicApiTransactionBreakdown"
    },
    "humanReadableWhy": {
      "type": "string"
    },
    "history": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PublicApiTransactionHistoryEvent"
      }
    }
  },
  "$defs": {
    "PublicApiTransactionBreakdown": {
      "type": "object",
      "required": [
        "gross",
        "grossCurrency",
        "refundedAmount",
        "refundedCurrency",
        "remainingRefundable"
      ],
      "properties": {
        "gross": {
          "$ref": "#/$defs/SharedTypes.MoneyAmountValue"
        },
        "grossCurrency": {
          "$ref": "#/$defs/SharedTypes.CurrencyCode"
        },
        "refundedAmount": {
          "$ref": "#/$defs/SharedTypes.MoneyAmountValue"
        },
        "refundedCurrency": {
          "$ref": "#/$defs/SharedTypes.CurrencyCode"
        },
        "remainingRefundable": {
          "$ref": "#/$defs/SharedTypes.MoneyAmountValue"
        },
        "net": {
          "$ref": "#/$defs/SharedTypes.MoneyAmountValue"
        },
        "netCurrency": {
          "$ref": "#/$defs/SharedTypes.CurrencyCode"
        }
      }
    },
    "PublicApiTransactionHistoryEvent": {
      "type": "object",
      "required": [
        "event",
        "timestamp"
      ],
      "properties": {
        "event": {
          "type": "string"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time"
        },
        "id": {
          "type": "string"
        },
        "amount": {
          "$ref": "#/$defs/SharedTypes.MoneyAmountValue"
        },
        "currency": {
          "$ref": "#/$defs/SharedTypes.CurrencyCode"
        },
        "type": {
          "type": "string"
        },
        "triggeredBy": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "string"
        },
        "occurredAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "PublicApiTransactionMethod": {
      "type": "object",
      "properties": {
        "scheme": {
          "type": "string"
        },
        "lastFour": {
          "type": "string"
        }
      }
    },
    "SharedTypes.CurrencyCode": {
      "type": "string",
      "pattern": "^[a-z]{3}$",
      "description": "ISO 4217 currency code. Always lowercase (e.g. 'usd', 'eur')."
    },
    "SharedTypes.MoneyAmountValue": {
      "type": "number",
      "format": "decimal",
      "description": "Decimal money amount for financial values."
    }
  }
}