{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/plaxswap-com/json-schema/plaxswap-com-checkout-view-schema.json",
  "title": "CheckoutView",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/plaxswap-com-openapi.json#/components/schemas/CheckoutView",
  "type": "object",
  "properties": {
    "trackingUrl": {
      "type": "string",
      "description": "Public single-page payment and tracking link.",
      "format": "uri"
    },
    "receiveMode": {
      "type": "string",
      "enum": [
        "selected",
        "original"
      ]
    },
    "receiveLockedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "id": {
      "type": "string"
    },
    "livemode": {
      "type": "boolean"
    },
    "status": {
      "$ref": "#/$defs/PaymentStatus"
    },
    "merchant": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "website": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "name",
        "website"
      ]
    },
    "orderId": {
      "type": [
        "string",
        "null"
      ]
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "amount": {
      "type": "string"
    },
    "currency": {
      "type": "string"
    },
    "receive": {
      "$ref": "#/$defs/MethodRef"
    },
    "receiveAmount": {
      "type": "string",
      "pattern": "^\\d+(\\.\\d+)?$"
    },
    "fee": {
      "$ref": "#/$defs/PaymentFee"
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time"
    },
    "returnUrl": {
      "type": [
        "string",
        "null"
      ]
    },
    "cancelUrl": {
      "type": [
        "string",
        "null"
      ]
    },
    "options": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CheckoutOption"
      }
    },
    "ask": {
      "anyOf": [
        {
          "$ref": "#/$defs/CheckoutAsk"
        },
        {
          "type": "null"
        }
      ]
    },
    "paidFraction": {
      "type": "number",
      "description": "Share of the amount asked that arrived, 0 to 1 (more when overpaid)."
    },
    "late": {
      "type": "boolean"
    },
    "overpaid": {
      "type": "boolean"
    },
    "underReview": {
      "type": "boolean"
    },
    "transactions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PaymentTransaction"
      }
    },
    "receivedBalances": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "method": {
            "$ref": "#/$defs/MethodRef"
          },
          "amount": {
            "type": "string",
            "pattern": "^\\d+(\\.\\d+)?$"
          }
        },
        "required": [
          "method",
          "amount"
        ]
      }
    },
    "testOutcomes": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/TestOutcome"
      }
    }
  },
  "required": [
    "trackingUrl",
    "receiveMode",
    "receiveLockedAt",
    "id",
    "livemode",
    "status",
    "merchant",
    "orderId",
    "description",
    "amount",
    "currency",
    "receive",
    "receiveAmount",
    "fee",
    "expiresAt",
    "returnUrl",
    "cancelUrl",
    "options",
    "ask",
    "paidFraction",
    "late",
    "overpaid",
    "underReview",
    "transactions",
    "receivedBalances",
    "testOutcomes"
  ],
  "$defs": {
    "CheckoutAsk": {
      "type": "object",
      "properties": {
        "method": {
          "$ref": "#/$defs/MethodRef"
        },
        "amount": {
          "type": "string",
          "description": "Send exactly this much.",
          "pattern": "^\\d+(\\.\\d+)?$"
        },
        "remaining": {
          "type": "string",
          "description": "Still to send after what arrived.",
          "pattern": "^\\d+(\\.\\d+)?$"
        },
        "orderId": {
          "type": "string"
        },
        "depositAddress": {
          "type": [
            "string",
            "null"
          ],
          "description": "null while an identity check must come first, or once the payment is closed."
        },
        "depositMemo": {
          "type": [
            "string",
            "null"
          ]
        },
        "kycRequired": {
          "type": "boolean"
        }
      },
      "required": [
        "method",
        "amount",
        "remaining",
        "orderId",
        "depositAddress",
        "depositMemo",
        "kycRequired"
      ]
    },
    "CheckoutOption": {
      "type": "object",
      "properties": {
        "method": {
          "$ref": "#/$defs/MethodRef"
        },
        "route": {
          "$ref": "#/$defs/CheckoutRoute"
        },
        "available": {
          "type": "boolean"
        },
        "reason": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "method",
        "route",
        "available",
        "reason"
      ]
    },
    "CheckoutRoute": {
      "type": "string",
      "description": "same: the coin the merchant receives, passed on. uniswap / swapkit: converted.",
      "enum": [
        "same",
        "uniswap",
        "swapkit"
      ]
    },
    "DepositStatus": {
      "type": "string",
      "enum": [
        "pending",
        "processing",
        "review",
        "settling",
        "settled",
        "refund",
        "refunding",
        "refunded",
        "frozen",
        "failed"
      ]
    },
    "MethodRef": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "assetId": {
          "type": "string"
        },
        "networkId": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "decimals": {
          "type": "integer"
        },
        "memoRequired": {
          "type": "boolean"
        }
      },
      "required": [
        "id",
        "assetId",
        "networkId",
        "label",
        "decimals",
        "memoRequired"
      ]
    },
    "PaymentFee": {
      "type": "object",
      "properties": {
        "bps": {
          "type": "integer",
          "description": "Basis points: 100 = 1%."
        },
        "paidBy": {
          "type": "string",
          "enum": [
            "merchant",
            "customer"
          ]
        },
        "amount": {
          "type": "string",
          "description": "In the receive coin.",
          "pattern": "^\\d+(\\.\\d+)?$"
        }
      },
      "required": [
        "bps",
        "paidBy",
        "amount"
      ]
    },
    "PaymentStatus": {
      "type": "string",
      "enum": [
        "pending",
        "confirming",
        "paid",
        "partially_paid",
        "expired",
        "cancelled",
        "failed"
      ]
    },
    "PaymentTransaction": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "orderId": {
          "type": "string"
        },
        "status": {
          "$ref": "#/$defs/DepositStatus"
        },
        "payCurrency": {
          "$ref": "#/$defs/MethodRef"
        },
        "receiveCurrency": {
          "$ref": "#/$defs/MethodRef"
        },
        "amount": {
          "type": "string",
          "description": "What the payer sent, in payCurrency.",
          "pattern": "^\\d+(\\.\\d+)?$"
        },
        "txid": {
          "type": [
            "string",
            "null"
          ]
        },
        "txUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "receivedAmount": {
          "type": [
            "string",
            "null"
          ],
          "description": "What it gave you, in the receive coin, once it reached you.",
          "pattern": "^\\d+(\\.\\d+)?$"
        },
        "payoutTxid": {
          "type": [
            "string",
            "null"
          ],
          "description": "The transfer to your address."
        },
        "payoutTxUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "late": {
          "type": "boolean",
          "description": "It arrived after the payment expired."
        },
        "detectedAt": {
          "type": "string",
          "format": "date-time"
        },
        "settledAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      },
      "required": [
        "id",
        "orderId",
        "status",
        "payCurrency",
        "receiveCurrency",
        "amount",
        "txid",
        "txUrl",
        "receivedAmount",
        "payoutTxid",
        "payoutTxUrl",
        "late",
        "detectedAt",
        "settledAt"
      ]
    },
    "TestOutcome": {
      "type": "string",
      "enum": [
        "paid",
        "partially_paid",
        "overpaid",
        "late",
        "expired",
        "failed"
      ]
    }
  }
}