{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nmi/json-schema/nmi-plan-create-request-schema.json",
  "title": "PlanCreateRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nmi-plans-api-openapi.yml#/components/schemas/PlanCreateRequest",
  "type": "object",
  "required": [
    "plan_amount",
    "plan_payments"
  ],
  "properties": {
    "plan_amount": {
      "type": "number",
      "minimum": 0,
      "description": "The plan amount to be charged each billing cycle. Format: `x.xx`"
    },
    "plan_payments": {
      "type": "integer",
      "minimum": 0,
      "maximum": 999,
      "description": "The number of payments before the recurring plan is complete. Use '0' for until canceled"
    },
    "id": {
      "type": "string",
      "maxLength": 50,
      "description": "The unique identifier for the plan. Required when creating a plan directly; optional when defining a custom plan inline via a subscription."
    },
    "plan_name": {
      "type": "string",
      "maxLength": 50,
      "description": "The display name of the plan"
    }
  },
  "oneOf": [
    {
      "title": "Monthly Plan",
      "required": [
        "month_frequency",
        "day_of_month"
      ],
      "properties": {
        "month_frequency": {
          "type": "integer",
          "minimum": 1,
          "maximum": 24,
          "description": "How often, in months, to charge the customer."
        },
        "day_of_month": {
          "type": "integer",
          "minimum": 1,
          "maximum": 31,
          "description": "The day of the month that the customer will be charged. For months without 29, 30, or 31 days, the charge will be on the last day."
        }
      }
    },
    {
      "title": "Daily Plan",
      "required": [
        "day_frequency"
      ],
      "properties": {
        "day_frequency": {
          "type": "integer",
          "minimum": 1,
          "description": "How often, in days, to charge the customer."
        }
      }
    }
  ]
}