{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/plaxswap-com/json-schema/plaxswap-com-payment-view-schema.json",
  "title": "PaymentView",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/plaxswap-com-openapi.json#/components/schemas/PaymentView",
  "type": "object",
  "properties": {
    "trackingUrl": {
      "type": "string",
      "description": "Public single-page payment and tracking link.",
      "format": "uri"
    },
    "quotedReceivePriceUsd": {
      "type": [
        "number",
        "null"
      ]
    },
    "receiveMode": {
      "type": "string",
      "enum": [
        "selected",
        "original"
      ]
    },
    "receiveLockedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "customer": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 120
        },
        "email": {
          "type": "string",
          "maxLength": 254,
          "format": "email"
        },
        "note": {
          "type": "string",
          "maxLength": 500
        }
      },
      "additionalProperties": false
    },
    "id": {
      "type": "string",
      "pattern": "^pay_[0-9a-z]{16}$"
    },
    "object": {
      "type": "string",
      "const": "payment"
    },
    "livemode": {
      "type": "boolean",
      "description": "false for payments made with a test key."
    },
    "status": {
      "$ref": "#/$defs/PaymentStatus"
    },
    "amount": {
      "type": "string",
      "description": "The price as you gave it."
    },
    "currency": {
      "type": "string"
    },
    "receive": {
      "$ref": "#/$defs/MethodRef"
    },
    "receiveAddress": {
      "type": "string"
    },
    "receiveMemo": {
      "type": [
        "string",
        "null"
      ]
    },
    "receiveAmount": {
      "type": "string",
      "description": "The price in the receive coin, fixed when the payment was made.",
      "pattern": "^\\d+(\\.\\d+)?$"
    },
    "expectedAmount": {
      "type": "string",
      "description": "What you should receive: receiveAmount, less the platform fee when you pay it.",
      "pattern": "^\\d+(\\.\\d+)?$"
    },
    "receivedAmount": {
      "type": "string",
      "description": "Settled amount in the current receive method only; see receivedBalances for all assets.",
      "pattern": "^\\d+(\\.\\d+)?$"
    },
    "receivedBalances": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "method": {
            "$ref": "#/$defs/MethodRef"
          },
          "amount": {
            "type": "string",
            "pattern": "^\\d+(\\.\\d+)?$"
          }
        },
        "required": [
          "method",
          "amount"
        ]
      }
    },
    "fee": {
      "$ref": "#/$defs/PaymentFee"
    },
    "orderId": {
      "type": [
        "string",
        "null"
      ]
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "metadata": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "checkoutUrl": {
      "type": "string",
      "description": "Send the payer here.",
      "format": "uri"
    },
    "returnUrl": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri"
    },
    "cancelUrl": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri"
    },
    "late": {
      "type": "boolean",
      "description": "Coins arrived after the payment expired (still passed on to you)."
    },
    "overpaid": {
      "type": "boolean",
      "description": "The payer sent clearly more than asked (everything is passed on to you)."
    },
    "underReview": {
      "type": "boolean",
      "description": "A transfer is held for a compliance review."
    },
    "payCurrency": {
      "anyOf": [
        {
          "$ref": "#/$defs/MethodRef"
        },
        {
          "type": "null"
        }
      ]
    },
    "transactions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PaymentTransaction"
      }
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time"
    },
    "paidAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "shortfall": {
      "type": [
        "string",
        "null"
      ],
      "description": "Paid inside the short-payment allowance: how much less than expectedAmount arrived, in the receive coin. Null when nothing is short.",
      "pattern": "^\\d+(\\.\\d+)?$"
    },
    "toleranceBps": {
      "type": "integer",
      "description": "The short-payment allowance of this payment in basis points (50 = 0.5%): it counts as paid from expectedAmount less this share. Set when the payment is made, from your account setting."
    }
  },
  "required": [
    "trackingUrl",
    "quotedReceivePriceUsd",
    "receiveMode",
    "receiveLockedAt",
    "customer",
    "id",
    "object",
    "livemode",
    "status",
    "amount",
    "currency",
    "receive",
    "receiveAddress",
    "receiveMemo",
    "receiveAmount",
    "expectedAmount",
    "receivedAmount",
    "receivedBalances",
    "fee",
    "orderId",
    "description",
    "metadata",
    "checkoutUrl",
    "returnUrl",
    "cancelUrl",
    "late",
    "overpaid",
    "underReview",
    "payCurrency",
    "transactions",
    "createdAt",
    "expiresAt",
    "paidAt"
  ],
  "$defs": {
    "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"
      ]
    }
  }
}