{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/paypal/json-schema/paypal-plan-update-request-schema.json",
  "title": "PlanUpdateRequest",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/paypal-plans-api-openapi.yml#/components/schemas/PlanUpdateRequest",
  "allOf": [
    {
      "$ref": "#/$defs/PlanRequest"
    },
    {
      "type": "object",
      "properties": {
        "cascading_updates": {
          "description": "Determines if changes made to the parent plan should be cascaded to the overridden plans in subscription",
          "type": "boolean"
        },
        "usage_based_charges": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/UsageBasedChargeUpdateRequest"
          }
        }
      }
    }
  ],
  "$defs": {
    "Amount": {
      "allOf": [
        {
          "$ref": "#/$defs/AmountNoCurrency"
        },
        {
          "type": "object",
          "required": [
            "currency_code"
          ],
          "properties": {
            "currency_code": {
              "$ref": "#/$defs/Currency"
            }
          }
        }
      ]
    },
    "AmountNoCurrency": {
      "type": "object",
      "required": [
        "value"
      ],
      "properties": {
        "value": {
          "type": "number",
          "format": "decimal",
          "description": "The amount value in the corresponding currency unit (e.g., two decimals for USD, no decimals for JPY).",
          "minimum": 0,
          "nullable": false,
          "default": 0
        }
      }
    },
    "BillingCycle": {
      "type": "string",
      "description": "The billing cycle indicating how often the subscription is charged",
      "enum": [
        "WEEKLY",
        "MONTHLY",
        "QUARTERLY",
        "YEARLY"
      ],
      "x-enum-varnames": [
        "WEEKLY",
        "MONTHLY",
        "QUARTERLY",
        "YEARLY"
      ],
      "x-enum-descriptions": [
        "Recurring billing occurs every week",
        "Recurring billing occurs every month",
        "Recurring billing occurs every three months",
        "Recurring billing occurs once a year"
      ]
    },
    "ChargeModel": {
      "type": "string",
      "description": "The pricing model applied to this charge",
      "enum": [
        "STANDARD",
        "GRADUATED",
        "PACKAGE",
        "PERCENTAGE",
        "VOLUME"
      ],
      "x-enum-varnames": [
        "STANDARD",
        "GRADUATED",
        "PACKAGE",
        "PERCENTAGE",
        "VOLUME"
      ],
      "x-enum-descriptions": [
        "Standard pricing model where a fixed amount is charged per unit",
        "Graduated pricing model where the price per unit decreases as the quantity increases",
        "Package pricing model where a fixed price is charged for a set of units",
        "Percentage pricing model where a percentage of a base amount is charged",
        "Volume-based pricing model where the price varies based on the total volume consumed"
      ],
      "default": "STANDARD"
    },
    "Currency": {
      "type": "string",
      "description": "Currency code in ISO 4217 format.",
      "minLength": 3,
      "maxLength": 3,
      "pattern": "^[A-Z]{3}$"
    },
    "MinimumCommitmentRequest": {
      "type": "object",
      "description": "Minimum commitment for this plan.",
      "required": [
        "amount"
      ],
      "properties": {
        "amount": {
          "allOf": [
            {
              "$ref": "#/$defs/AmountNoCurrency"
            }
          ]
        },
        "invoice_display_name": {
          "type": "string",
          "description": "Specifies the name that will be displayed on an invoice. If no value is set for this field, the default name will be used as the display name."
        },
        "tax_codes": {
          "$ref": "#/$defs/TaxCodes"
        }
      }
    },
    "PlanRequest": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "code": {
          "type": "string"
        },
        "billing_cycle": {
          "$ref": "#/$defs/BillingCycle"
        },
        "description": {
          "type": "string"
        },
        "amount": {
          "allOf": [
            {
              "$ref": "#/$defs/Amount"
            }
          ]
        },
        "trial_period": {
          "type": "integer"
        },
        "pay_in_advance": {
          "type": "boolean"
        },
        "tax_codes": {
          "$ref": "#/$defs/TaxCodes"
        },
        "minimum_commitment": {
          "allOf": [
            {
              "$ref": "#/$defs/MinimumCommitmentRequest"
            }
          ]
        }
      }
    },
    "TaxCodes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "List of unique codes used to identify taxes to be applied."
    },
    "UsageBasedChargeUpdateRequest": {
      "type": "object",
      "required": [
        "id",
        "metric_id"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier of the charge"
        },
        "metric_id": {
          "type": "string",
          "description": "Unique identifier of the metric"
        },
        "charge_model": {
          "$ref": "#/$defs/ChargeModel",
          "description": "Defines the pricing model to calculate the charge"
        },
        "tax_codes": {
          "$ref": "#/$defs/TaxCodes"
        },
        "properties": {
          "type": "object",
          "description": "Pricing thresholds that determine the charges"
        },
        "min_amount": {
          "allOf": [
            {
              "$ref": "#/$defs/AmountNoCurrency"
            }
          ]
        }
      }
    }
  }
}