{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/payments-ai/json-schema/payments-ai-public-checkout-by-invoice-response-schema.json",
  "title": "PublicCheckoutByInvoiceResponse",
  "description": "Keyless invoice checkout. The order read plus the invoice number, due date, and status.",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/payments-ai-mor-openapi.json#/components/schemas/PublicCheckoutByInvoiceResponse",
  "type": "object",
  "required": [
    "orderId",
    "checkoutUrl",
    "currency",
    "amountDue",
    "recurringAmount",
    "billingPeriod",
    "periodLength",
    "trialPeriodDays",
    "items",
    "merchantId",
    "paymentMethodTypes",
    "customization",
    "websiteUrl",
    "termsUrl",
    "privacyUrl",
    "returnPolicyUrl",
    "eulaUrl",
    "externalInvoiceNumber",
    "dueAt",
    "status"
  ],
  "properties": {
    "orderId": {
      "type": "string"
    },
    "checkoutUrl": {
      "type": "string"
    },
    "currency": {
      "$ref": "#/$defs/SharedTypes.CurrencyCode"
    },
    "amountDue": {
      "allOf": [
        {
          "$ref": "#/$defs/SharedTypes.MoneyAmountValue"
        }
      ],
      "description": "Amount the buyer owes today, before tax."
    },
    "recurringAmount": {
      "type": [
        "number",
        "null"
      ],
      "allOf": [
        {
          "$ref": "#/$defs/SharedTypes.MoneyAmountValue"
        }
      ],
      "description": "Later renewal total. Null when the order has no recurring item."
    },
    "billingPeriod": {
      "allOf": [
        {
          "$ref": "#/$defs/PublicOrderBillingPeriod"
        }
      ],
      "nullable": true
    },
    "periodLength": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int32"
    },
    "trialPeriodDays": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int32"
    },
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PublicOrderItemResponse"
      }
    },
    "merchantId": {
      "type": "string"
    },
    "externalMerchantId": {
      "type": "string",
      "description": "Account id used to mount payment fields. Omitted when the merchant is not linked."
    },
    "externalPlanId": {
      "type": "string",
      "description": "Plan the trial starts on when amountDue is zero (e.g. trial-only orders). Payment fields then mount in setup mode to save the card, and confirm starts the trial on this plan. Present only while the order is open with nothing due today and the plan is linked."
    },
    "paymentMethodTypes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Enabled payment method types for this merchant. Empty when none are enabled."
    },
    "customization": {
      "$ref": "#/$defs/CheckoutCustomization"
    },
    "websiteUrl": {
      "type": [
        "string",
        "null"
      ],
      "description": "Merchant store URL from business settings (`merchants.url`). Null when not configured."
    },
    "termsUrl": {
      "type": [
        "string",
        "null"
      ],
      "description": "Seller Terms URL or stable API redirect for a PDF. Null when unset."
    },
    "privacyUrl": {
      "type": [
        "string",
        "null"
      ],
      "description": "Seller Privacy URL or stable API redirect for a PDF. Null when unset."
    },
    "returnPolicyUrl": {
      "type": [
        "string",
        "null"
      ],
      "description": "Seller Return policy URL or stable API redirect for a PDF. Null when unset."
    },
    "eulaUrl": {
      "type": [
        "string",
        "null"
      ],
      "description": "Seller EULA URL or stable API redirect for a PDF. Null when unset."
    },
    "discount": {
      "allOf": [
        {
          "$ref": "#/$defs/PublicCheckoutDiscount"
        }
      ],
      "description": "Stored store-wide discount. Present after confirm saved a code. Omitted when none is applied."
    },
    "externalInvoiceNumber": {
      "type": [
        "string",
        "null"
      ]
    },
    "dueAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "status": {
      "type": "string"
    }
  },
  "$defs": {
    "CheckoutCustomization": {
      "type": "object",
      "properties": {
        "themeMode": {
          "$ref": "#/$defs/CheckoutThemeMode"
        },
        "backgroundColor": {
          "type": "string"
        },
        "buttonColor": {
          "type": "string"
        },
        "buttonTextColor": {
          "type": "string"
        },
        "fontColor": {
          "type": "string",
          "description": "Primary body/content text color for the merchant product panel."
        },
        "logoUrl": {
          "type": "string",
          "description": "Presigned URL resolved on the read side from the stored `logoPath` S3 key."
        },
        "logoExpiresAt": {
          "type": "string",
          "format": "date-time",
          "description": "ISO-8601 UTC expiry of `logoUrl`. Refresh the checkout context before this moment."
        },
        "fontFamily": {
          "$ref": "#/$defs/CheckoutFontFamily"
        },
        "inputStyle": {
          "allOf": [
            {
              "$ref": "#/$defs/CheckoutInputStyle"
            }
          ],
          "description": "Corner radius preset for checkout inputs (`rounded` maps to 8px, `square` to 0)."
        }
      }
    },
    "CheckoutFontFamily": {
      "type": "string",
      "enum": [
        "Inter",
        "Roboto"
      ]
    },
    "CheckoutInputStyle": {
      "type": "string",
      "enum": [
        "rounded",
        "square"
      ]
    },
    "CheckoutThemeMode": {
      "type": "string",
      "enum": [
        "light",
        "dark"
      ]
    },
    "PublicCheckoutDiscount": {
      "type": "object",
      "required": [
        "code",
        "discountAmount",
        "billingPeriod",
        "billingPeriodLength",
        "billingPeriodUnit"
      ],
      "properties": {
        "code": {
          "type": "string",
          "description": "Buyer-entered code stored on the order. Never the processor promo id."
        },
        "discountAmount": {
          "$ref": "#/$defs/SharedTypes.MoneyAmountValue"
        },
        "billingPeriod": {
          "type": "string",
          "description": "once | repeating | forever"
        },
        "billingPeriodLength": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        },
        "billingPeriodUnit": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "PublicOrderBillingPeriod": {
      "type": "string",
      "enum": [
        "day",
        "week",
        "month",
        "year"
      ]
    },
    "PublicOrderItemResponse": {
      "type": "object",
      "required": [
        "label",
        "unitPrice",
        "quantity",
        "lineTotal",
        "itemType"
      ],
      "properties": {
        "label": {
          "type": "string"
        },
        "unitPrice": {
          "$ref": "#/$defs/SharedTypes.MoneyAmountValue"
        },
        "quantity": {
          "type": "integer",
          "format": "int32",
          "minimum": 1
        },
        "lineTotal": {
          "$ref": "#/$defs/SharedTypes.MoneyAmountValue"
        },
        "itemType": {
          "$ref": "#/$defs/PublicOrderItemType"
        },
        "billingPeriod": {
          "$ref": "#/$defs/PublicOrderBillingPeriod"
        },
        "periodLength": {
          "type": "integer",
          "format": "int32",
          "minimum": 1
        }
      },
      "description": "One line on a payable checkout order. Recurring lines include cadence; one-time lines omit it."
    },
    "PublicOrderItemType": {
      "type": "string",
      "enum": [
        "one_time",
        "recurring"
      ]
    },
    "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."
    }
  }
}