{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/crevio-co/json-schema/crevio-co-order-schema.json",
  "title": "Order",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/crevio-co-checkouts-api-openapi.yml#/components/schemas/Order",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "object": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "succeeded",
        "pending",
        "failed",
        "refunded",
        "partially_refunded",
        "disputed"
      ]
    },
    "livemode": {
      "type": "boolean"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "metadata": {
      "type": [
        "object",
        "null"
      ]
    },
    "amount": {
      "type": "integer",
      "description": "Amount charged after discounts, in the smallest currency unit (79 = $0.79)."
    },
    "currency": {
      "type": "string"
    },
    "amount_refunded": {
      "type": "integer",
      "description": "Amount refunded so far, in the smallest currency unit."
    },
    "customer": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "$ref": "#/$defs/Customer"
        },
        {
          "type": "null"
        }
      ],
      "description": "ID by default, full object when expanded"
    },
    "line_items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/OrderItem"
      }
    },
    "checkout": {
      "type": [
        "string",
        "null"
      ],
      "description": "Null for a renewal, which no checkout started."
    },
    "billing_reason": {
      "type": [
        "string",
        "null"
      ],
      "description": "As Stripe names the invoice: `subscription_create` for the purchase that started a subscription, `subscription_cycle` for each paid renewal after it. Null for a one-time purchase.",
      "enum": [
        "subscription_create",
        "subscription_cycle",
        null
      ]
    },
    "subscription": {
      "type": [
        "string",
        "null"
      ],
      "description": "The subscription this order started or renewed."
    },
    "billing_address": {
      "oneOf": [
        {
          "$ref": "#/$defs/Address"
        },
        {
          "type": "null"
        }
      ]
    },
    "shipping_address": {
      "oneOf": [
        {
          "$ref": "#/$defs/Address"
        },
        {
          "type": "null"
        }
      ]
    },
    "charge": {
      "type": [
        "string",
        "null"
      ]
    },
    "form_submissions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/FormSubmission"
      },
      "description": "The buyer's answers to the price variant's form at checkout."
    }
  },
  "required": [
    "id",
    "object",
    "status",
    "livemode",
    "created_at",
    "updated_at",
    "metadata",
    "amount",
    "currency",
    "amount_refunded",
    "customer",
    "checkout",
    "billing_reason",
    "subscription",
    "billing_address",
    "shipping_address",
    "charge",
    "form_submissions"
  ],
  "$defs": {
    "Address": {
      "type": "object",
      "properties": {
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "line1": {
          "type": [
            "string",
            "null"
          ]
        },
        "line2": {
          "type": [
            "string",
            "null"
          ]
        },
        "city": {
          "type": [
            "string",
            "null"
          ]
        },
        "state": {
          "type": [
            "string",
            "null"
          ]
        },
        "postal_code": {
          "type": [
            "string",
            "null"
          ]
        },
        "country": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "name",
        "line1",
        "line2",
        "city",
        "state",
        "postal_code",
        "country"
      ]
    },
    "Customer": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "object": {
          "type": "string"
        },
        "email": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "first_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "last_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "phone_number": {
          "type": [
            "string",
            "null"
          ]
        },
        "customer_type": {
          "type": "string",
          "enum": [
            "paid",
            "free",
            "lead"
          ]
        },
        "notes": {
          "type": [
            "string",
            "null"
          ]
        },
        "confirmed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        },
        "deleted_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "purge_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "anonymized": {
          "type": "boolean"
        },
        "metadata": {
          "type": "object"
        },
        "orders_count": {
          "type": "integer"
        },
        "total_spend": {
          "type": "number"
        },
        "tags": {
          "type": "array"
        }
      },
      "required": [
        "id",
        "object",
        "email",
        "name",
        "first_name",
        "last_name",
        "phone_number",
        "customer_type",
        "notes",
        "confirmed_at",
        "created_at",
        "updated_at",
        "deleted_at",
        "purge_at",
        "anonymized",
        "metadata",
        "orders_count",
        "total_spend",
        "tags"
      ]
    },
    "FormSubmission": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "object": {
          "type": "string"
        },
        "answers": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "field_type": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "value": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "A `consent` answer is `true` when the person ticked it."
              },
              "options": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "field_type",
              "label",
              "required",
              "value"
            ]
          }
        },
        "respondent_type": {
          "type": "string"
        },
        "confirmation_requested_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "confirmed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "delivered_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "respondent_id": {
          "type": "string"
        },
        "form_id": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "object",
        "answers",
        "respondent_type",
        "confirmation_requested_at",
        "confirmed_at",
        "delivered_at",
        "created_at",
        "respondent_id",
        "form_id"
      ]
    },
    "MediaGalleryItem": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "category": {
          "type": "string",
          "enum": [
            "image",
            "video",
            "external"
          ]
        },
        "url": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "type",
        "category",
        "url"
      ]
    },
    "Order": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "object": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "succeeded",
            "pending",
            "failed",
            "refunded",
            "partially_refunded",
            "disputed"
          ]
        },
        "livemode": {
          "type": "boolean"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        },
        "metadata": {
          "type": [
            "object",
            "null"
          ]
        },
        "amount": {
          "type": "integer",
          "description": "Amount charged after discounts, in the smallest currency unit (79 = $0.79)."
        },
        "currency": {
          "type": "string"
        },
        "amount_refunded": {
          "type": "integer",
          "description": "Amount refunded so far, in the smallest currency unit."
        },
        "customer": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/$defs/Customer"
            },
            {
              "type": "null"
            }
          ],
          "description": "ID by default, full object when expanded"
        },
        "line_items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/OrderItem"
          }
        },
        "checkout": {
          "type": [
            "string",
            "null"
          ],
          "description": "Null for a renewal, which no checkout started."
        },
        "billing_reason": {
          "type": [
            "string",
            "null"
          ],
          "description": "As Stripe names the invoice: `subscription_create` for the purchase that started a subscription, `subscription_cycle` for each paid renewal after it. Null for a one-time purchase.",
          "enum": [
            "subscription_create",
            "subscription_cycle",
            null
          ]
        },
        "subscription": {
          "type": [
            "string",
            "null"
          ],
          "description": "The subscription this order started or renewed."
        },
        "billing_address": {
          "oneOf": [
            {
              "$ref": "#/$defs/Address"
            },
            {
              "type": "null"
            }
          ]
        },
        "shipping_address": {
          "oneOf": [
            {
              "$ref": "#/$defs/Address"
            },
            {
              "type": "null"
            }
          ]
        },
        "charge": {
          "type": [
            "string",
            "null"
          ]
        },
        "form_submissions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FormSubmission"
          },
          "description": "The buyer's answers to the price variant's form at checkout."
        }
      },
      "required": [
        "id",
        "object",
        "status",
        "livemode",
        "created_at",
        "updated_at",
        "metadata",
        "amount",
        "currency",
        "amount_refunded",
        "customer",
        "checkout",
        "billing_reason",
        "subscription",
        "billing_address",
        "shipping_address",
        "charge",
        "form_submissions"
      ]
    },
    "OrderItem": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "object": {
          "type": "string"
        },
        "quantity": {
          "type": "integer"
        },
        "amount": {
          "type": "integer"
        },
        "order": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/$defs/Order"
            },
            {
              "type": "null"
            }
          ],
          "description": "ID by default, full object when expanded"
        },
        "price_variant": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/$defs/PriceVariant"
            },
            {
              "type": "null"
            }
          ],
          "description": "ID by default, full object when expanded"
        },
        "product": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/$defs/Product"
            },
            {
              "type": "null"
            }
          ],
          "description": "ID by default, full object when expanded"
        }
      },
      "required": [
        "id",
        "object",
        "quantity",
        "amount",
        "price_variant",
        "product"
      ]
    },
    "PriceVariant": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "object": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "amount": {
          "type": [
            "integer",
            "null"
          ]
        },
        "amount_type": {
          "type": "string",
          "enum": [
            "free",
            "fixed",
            "custom"
          ]
        },
        "billing_type": {
          "type": "string",
          "enum": [
            "subscription",
            "one_time",
            "payment_plan"
          ]
        },
        "recurring_interval": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "day",
            "week",
            "month",
            "year",
            null
          ]
        },
        "interval_count": {
          "type": "integer"
        },
        "installment_count": {
          "type": [
            "integer",
            "null"
          ]
        },
        "setup_fee_amount": {
          "type": [
            "integer",
            "null"
          ]
        },
        "trial_period_days": {
          "type": [
            "integer",
            "null"
          ]
        },
        "revoke_after_days": {
          "type": [
            "integer",
            "null"
          ]
        },
        "quantity_available": {
          "type": [
            "integer",
            "null"
          ]
        },
        "archived": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "position": {
          "type": "integer"
        },
        "hidden": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        },
        "currency": {
          "type": [
            "string",
            "null"
          ]
        },
        "discounted_from_amount": {
          "type": [
            "integer",
            "null"
          ]
        },
        "minimum_amount": {
          "type": [
            "integer",
            "null"
          ]
        },
        "maximum_amount": {
          "type": [
            "integer",
            "null"
          ]
        },
        "preset_amount": {
          "type": [
            "integer",
            "null"
          ]
        },
        "waitlist": {
          "type": "boolean"
        },
        "form_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "The form (`form_...`) asked at every checkout of this variant, including waitlist applications. Its answers become a form submission on the order or waitlist entry."
        },
        "benefits": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "purchase_url": {
          "type": "string"
        },
        "product": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "object",
        "name",
        "amount",
        "amount_type",
        "billing_type",
        "recurring_interval",
        "interval_count",
        "installment_count",
        "setup_fee_amount",
        "trial_period_days",
        "revoke_after_days",
        "quantity_available",
        "archived",
        "position",
        "hidden",
        "created_at",
        "updated_at",
        "currency",
        "discounted_from_amount",
        "minimum_amount",
        "maximum_amount",
        "preset_amount",
        "waitlist",
        "form_id",
        "purchase_url",
        "product"
      ]
    },
    "Product": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "object": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "draft",
            "active",
            "archived"
          ]
        },
        "description": {
          "type": "string"
        },
        "confirmation_message": {
          "type": [
            "string",
            "null"
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        },
        "metadata": {
          "type": "object"
        },
        "body_html": {
          "type": "string"
        },
        "button_cta": {
          "type": [
            "string",
            "null"
          ]
        },
        "url": {
          "type": "string"
        },
        "available_from": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "available_until": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "published_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "reviews_count": {
          "type": "integer"
        },
        "average_rating": {
          "type": [
            "number",
            "null"
          ]
        },
        "seo": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/$defs/Seo"
            },
            {
              "type": "null"
            }
          ],
          "description": "ID by default, full object when expanded"
        },
        "media_gallery": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MediaGalleryItem"
          }
        },
        "price_variants": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PriceVariant"
          }
        },
        "reviews": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Review"
          }
        }
      },
      "required": [
        "id",
        "object",
        "name",
        "slug",
        "status",
        "description",
        "confirmation_message",
        "created_at",
        "updated_at",
        "metadata",
        "body_html",
        "button_cta",
        "url",
        "available_from",
        "available_until",
        "published_at",
        "reviews_count",
        "average_rating",
        "media_gallery",
        "price_variants"
      ]
    },
    "Review": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "object": {
          "type": "string"
        },
        "rating": {
          "type": "integer"
        },
        "customer_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "content": {
          "type": [
            "string",
            "null"
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "customer_image_url": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "object",
        "rating",
        "customer_name",
        "content",
        "created_at",
        "customer_image_url"
      ]
    },
    "Seo": {
      "type": "object",
      "properties": {
        "title": {
          "type": [
            "string",
            "null"
          ]
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "title",
        "description"
      ]
    }
  }
}