{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/medianfi-com/json-schema/medianfi-com-checkout-subscription-response-schema.json",
  "title": "CheckoutSubscriptionResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/medianfi-com-checkout-api-openapi.yml#/components/schemas/CheckoutSubscriptionResponse",
  "type": "object",
  "required": [
    "id",
    "companyId",
    "status",
    "stripeSubscriptionStatus",
    "platformItemState",
    "platformItemId",
    "providerObservedAt",
    "platformTermsVerifiedAt",
    "stripeSubscriptionId",
    "stripePriceId",
    "currentPeriodStart",
    "currentPeriodEnd",
    "cancelledAt",
    "planTier",
    "plan",
    "billing",
    "paymentMethod",
    "paymentMethodStatus",
    "paymentMethodSummary",
    "source"
  ],
  "properties": {
    "id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "companyId": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "past_due",
        "cancelled",
        "trialing",
        "incomplete",
        "needs_attention"
      ],
      "description": "Missing or ambiguous platform items project needs_attention; cancellation takes precedence."
    },
    "stripeSubscriptionStatus": {
      "type": [
        "string",
        "null"
      ],
      "description": "Exact provider status from the last observation."
    },
    "platformItemState": {
      "type": "string",
      "enum": [
        "unverified",
        "present",
        "missing",
        "ambiguous"
      ]
    },
    "platformItemId": {
      "type": [
        "string",
        "null"
      ]
    },
    "providerObservedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "platformTermsVerifiedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "stripeSubscriptionId": {
      "type": [
        "string",
        "null"
      ]
    },
    "stripePriceId": {
      "type": [
        "string",
        "null"
      ]
    },
    "currentPeriodStart": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "currentPeriodEnd": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "cancelledAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "planTier": {
      "type": [
        "string",
        "null"
      ]
    },
    "plan": {
      "oneOf": [
        {
          "$ref": "#/$defs/CheckoutSubscriptionPlan"
        },
        {
          "type": "null"
        }
      ]
    },
    "billing": {
      "description": "Null when the billed amount cannot be read from Stripe (no\nsubscription, or Stripe unavailable). Clients must not present the\nplan's list price as the billed amount in that case.\n",
      "oneOf": [
        {
          "$ref": "#/$defs/CheckoutSubscriptionBilling"
        },
        {
          "type": "null"
        }
      ]
    },
    "paymentMethod": {
      "oneOf": [
        {
          "$ref": "#/$defs/CheckoutSubscriptionPaymentMethod"
        },
        {
          "type": "null"
        }
      ]
    },
    "paymentMethodStatus": {
      "type": "string",
      "enum": [
        "available",
        "none",
        "unavailable",
        "not_configured"
      ],
      "description": "Whether Stripe returned a payment method, confirmed that none is\nconfigured, or could not establish the answer. The not_configured\nstate means the company has no Stripe customer id; show \"No Stripe\nbilling on file\" without a Stripe portal action. An unavailable\nresult must not be presented as \"No payment method\". Neither state\npermits displaying the stored payment-method summary as current.\n"
    },
    "paymentMethodSummary": {
      "type": [
        "string",
        "null"
      ]
    },
    "source": {
      "type": "string",
      "enum": [
        "median_subscription",
        "stripe_resync",
        "billing_plan_fallback"
      ]
    }
  },
  "$defs": {
    "CheckoutSubscriptionBilling": {
      "type": "object",
      "description": "What Stripe actually charges the subscription each period. Differs from\nthe plan's list price whenever a coupon applies — a comped company has\nan effectiveAmountCents of 0 against a non-zero listAmountCents.\n",
      "required": [
        "listAmountCents",
        "effectiveAmountCents",
        "interval",
        "discountLabel",
        "trialEndsAt",
        "discountEndsAt"
      ],
      "properties": {
        "listAmountCents": {
          "type": "integer",
          "minimum": 0
        },
        "effectiveAmountCents": {
          "description": "The recurring charge each period once billing starts. While\ntrialEndsAt is set this amount is not yet being charged.\n",
          "type": "integer",
          "minimum": 0
        },
        "interval": {
          "type": "string",
          "enum": [
            "month",
            "year"
          ]
        },
        "discountLabel": {
          "type": [
            "string",
            "null"
          ]
        },
        "trialEndsAt": {
          "description": "Date the trial ends and effectiveAmountCents starts being charged.\nNon-null means nothing is due until then, and clients must show both\nthe zero due now and the recurring amount with this date.\n",
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "discountEndsAt": {
          "description": "Date the coupon expires and listAmountCents resumes. Null when the\ncoupon runs for the life of the subscription.\n",
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    },
    "CheckoutSubscriptionPaymentMethod": {
      "type": "object",
      "required": [
        "brand",
        "last4",
        "expMonth",
        "expYear"
      ],
      "properties": {
        "brand": {
          "type": "string"
        },
        "last4": {
          "type": "string"
        },
        "expMonth": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1,
          "maximum": 12
        },
        "expYear": {
          "type": [
            "integer",
            "null"
          ]
        }
      }
    },
    "CheckoutSubscriptionPlan": {
      "type": "object",
      "required": [
        "id",
        "name",
        "priceCents",
        "interval",
        "features"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        },
        "priceCents": {
          "type": "integer",
          "minimum": 0
        },
        "interval": {
          "type": "string",
          "enum": [
            "month",
            "year"
          ]
        },
        "features": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  }
}