{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://stripe.com/schemas/subscription",
  "title": "Stripe Subscription",
  "description": "Subscriptions allow you to charge a customer on a recurring basis. A subscription ties a customer to a particular plan or set of prices.",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the object.",
      "pattern": "^sub_"
    },
    "object": {
      "type": "string",
      "const": "subscription",
      "description": "String representing the object's type."
    },
    "application": {
      "type": ["string", "null"],
      "description": "ID of the Connect Application that created the subscription."
    },
    "application_fee_percent": {
      "type": ["number", "null"],
      "description": "A non-negative decimal between 0 and 100, with at most two decimal places."
    },
    "automatic_tax": {
      "type": "object",
      "description": "Automatic tax settings for this subscription.",
      "properties": {
        "enabled": { "type": "boolean" },
        "liability": { "type": ["object", "null"] }
      },
      "required": ["enabled"]
    },
    "billing_cycle_anchor": {
      "type": "integer",
      "description": "The reference point that aligns future billing cycle dates."
    },
    "billing_thresholds": {
      "type": ["object", "null"],
      "description": "Define thresholds at which an invoice will be sent."
    },
    "cancel_at": {
      "type": ["integer", "null"],
      "description": "A date in the future at which the subscription will automatically get canceled."
    },
    "cancel_at_period_end": {
      "type": "boolean",
      "description": "If the subscription has been canceled with the at_period_end flag set to true."
    },
    "canceled_at": {
      "type": ["integer", "null"],
      "description": "If the subscription has been canceled, the date of that cancellation."
    },
    "cancellation_details": {
      "type": ["object", "null"],
      "description": "Details about why this subscription was cancelled."
    },
    "collection_method": {
      "type": "string",
      "description": "How the subscription's invoices are collected.",
      "enum": ["charge_automatically", "send_invoice"]
    },
    "created": {
      "type": "integer",
      "description": "Time at which the object was created."
    },
    "currency": {
      "type": "string",
      "description": "Three-letter ISO currency code."
    },
    "current_period_end": {
      "type": "integer",
      "description": "End of the current period that the subscription has been invoiced for."
    },
    "current_period_start": {
      "type": "integer",
      "description": "Start of the current period that the subscription has been invoiced for."
    },
    "customer": {
      "type": "string",
      "description": "ID of the customer who owns the subscription."
    },
    "days_until_due": {
      "type": ["integer", "null"],
      "description": "Number of days a customer has to pay invoices generated by this subscription."
    },
    "default_payment_method": {
      "type": ["string", "null"],
      "description": "ID of the default payment method for the subscription."
    },
    "default_source": {
      "type": ["string", "null"],
      "description": "ID of the default payment source for the subscription."
    },
    "default_tax_rates": {
      "type": ["array", "null"],
      "description": "The tax rates that will apply to any subscription item that does not have tax_rates set.",
      "items": { "type": "object" }
    },
    "description": {
      "type": ["string", "null"],
      "description": "The subscription's description."
    },
    "discount": {
      "type": ["object", "null"],
      "description": "Describes the current discount applied to this subscription."
    },
    "ended_at": {
      "type": ["integer", "null"],
      "description": "If the subscription has ended, the date the subscription ended."
    },
    "items": {
      "type": "object",
      "description": "List of subscription items, each with an attached price."
    },
    "latest_invoice": {
      "type": ["string", "null"],
      "description": "The most recent invoice this subscription has generated."
    },
    "livemode": {
      "type": "boolean",
      "description": "Has the value true if the object exists in live mode."
    },
    "metadata": {
      "type": "object",
      "description": "Set of key-value pairs attached to the object.",
      "additionalProperties": { "type": "string" }
    },
    "next_pending_invoice_item_invoice": {
      "type": ["integer", "null"],
      "description": "Specifies the approximate timestamp on which any pending invoice items will be billed."
    },
    "on_behalf_of": {
      "type": ["string", "null"],
      "description": "The account (if any) the charge was made on behalf of for charges associated with this subscription."
    },
    "pause_collection": {
      "type": ["object", "null"],
      "description": "If specified, payment collection for this subscription will be paused."
    },
    "payment_settings": {
      "type": ["object", "null"],
      "description": "Payment settings passed on to invoices created by the subscription."
    },
    "pending_invoice_item_interval": {
      "type": ["object", "null"],
      "description": "Specifies an interval for how often to bill for any pending invoice items."
    },
    "pending_setup_intent": {
      "type": ["string", "null"],
      "description": "You can use this SetupIntent to collect user authentication."
    },
    "pending_update": {
      "type": ["object", "null"],
      "description": "If specified, pending updates that will be applied to the subscription once the latest_invoice has been paid."
    },
    "schedule": {
      "type": ["string", "null"],
      "description": "The schedule attached to the subscription."
    },
    "start_date": {
      "type": "integer",
      "description": "Date when the subscription was first created."
    },
    "status": {
      "type": "string",
      "description": "The status of the subscription.",
      "enum": [
        "active",
        "canceled",
        "incomplete",
        "incomplete_expired",
        "past_due",
        "paused",
        "trialing",
        "unpaid"
      ]
    },
    "test_clock": {
      "type": ["string", "null"],
      "description": "ID of the test clock this subscription belongs to."
    },
    "transfer_data": {
      "type": ["object", "null"],
      "description": "The data with which to automatically create a Transfer for each of the associated subscription's invoices."
    },
    "trial_end": {
      "type": ["integer", "null"],
      "description": "If the subscription has a trial, the end of that trial."
    },
    "trial_settings": {
      "type": ["object", "null"],
      "description": "Settings related to subscription trials."
    },
    "trial_start": {
      "type": ["integer", "null"],
      "description": "If the subscription has a trial, the beginning of that trial."
    }
  },
  "required": [
    "id",
    "object",
    "automatic_tax",
    "billing_cycle_anchor",
    "cancel_at_period_end",
    "collection_method",
    "created",
    "currency",
    "current_period_end",
    "current_period_start",
    "customer",
    "items",
    "livemode",
    "metadata",
    "start_date",
    "status"
  ]
}
