{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/paypal/json-schema/paypal-plan-update-response-schema.json",
  "title": "PlanUpdateResponse",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/paypal-plans-api-openapi.yml#/components/schemas/PlanUpdateResponse",
  "allOf": [
    {
      "$ref": "#/$defs/Plan"
    },
    {
      "type": "object",
      "properties": {
        "cascading_updates": {
          "description": "Determines if changes made to the parent plan should be cascaded to the children plans",
          "type": "boolean"
        },
        "updated_at": {
          "allOf": [
            {
              "$ref": "#/$defs/DateTimeWithZone"
            }
          ]
        }
      }
    }
  ],
  "$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}$"
    },
    "DateTimeWithZone": {
      "type": "string",
      "format": "date-time",
      "description": "Date and time in ISO 8601 format."
    },
    "MinimumCommitment": {
      "allOf": [
        {
          "$ref": "#/$defs/MinimumCommitmentBase"
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "format": "uuid",
              "description": "Unique identifier of the minimum commitment, created by Lago."
            },
            "plan_code": {
              "type": "string",
              "description": "The unique code representing the plan to be attached to the customer."
            },
            "created_at": {
              "type": "string",
              "format": "date-time",
              "description": "The date and time when the minimum commitment was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the minimum commitment was initially created."
            },
            "updated_at": {
              "type": "string",
              "format": "date-time",
              "description": "The date and time when the minimum commitment was updated. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the minimum commitment was initially created."
            }
          }
        }
      ]
    },
    "MinimumCommitmentBase": {
      "type": "object",
      "description": "Minimum commitment for this plan.",
      "required": [
        "amount"
      ],
      "properties": {
        "amount": {
          "allOf": [
            {
              "$ref": "#/$defs/Amount"
            }
          ]
        },
        "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."
        },
        "taxes": {
          "type": "array",
          "description": "List of tax entities configured for the minimum commitment.",
          "items": {
            "$ref": "#/$defs/TaxResponse"
          }
        }
      }
    },
    "Plan": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier of the plan. This ID is used internally to track the plan and cannot be modified."
        },
        "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"
        },
        "taxes": {
          "type": "array",
          "description": "List of tax entities configured for the plan.",
          "items": {
            "$ref": "#/$defs/TaxResponse"
          }
        },
        "usage_based_charges": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/UsageBasedCharge"
          }
        },
        "minimum_commitment": {
          "allOf": [
            {
              "$ref": "#/$defs/MinimumCommitment"
            }
          ]
        },
        "created_at": {
          "allOf": [
            {
              "$ref": "#/$defs/DateTimeWithZone"
            }
          ]
        }
      }
    },
    "TaxBase": {
      "description": "Base schema for tax request/response objects",
      "type": "object",
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the tax"
        },
        "rate": {
          "type": "string",
          "pattern": "^(?!0+(?:\\.0+)?$)(?:0?\\.\\d{1,2}|[1-9]\\d?(?:\\.\\d{1,2})?|100(?:\\.0{1,2})?)$",
          "description": "The percentage rate of the tax applied to transactions. A decimal amount from 0.01 to 100.00 inclusive, always with exactly two decimal places, no leading zeros except 0.xx."
        },
        "description": {
          "type": "string",
          "description": "Detailed description of the tax for internal reference"
        }
      }
    },
    "TaxCode": {
      "type": "string",
      "description": "Unique code used to identify the tax. Must contain only alphanumeric characters, underscores, and hyphens.",
      "pattern": "^[a-zA-Z0-9_-]*$"
    },
    "TaxResponse": {
      "description": "Represents a customizable tax rate that can be applied to invoices and fees",
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/TaxBase"
        },
        {
          "type": "object",
          "properties": {
            "code": {
              "$ref": "#/$defs/TaxCode"
            },
            "id": {
              "type": "string",
              "format": "uuid",
              "description": "Unique identifier of the tax"
            },
            "created_at": {
              "allOf": [
                {
                  "$ref": "#/$defs/DateTimeWithZone"
                },
                {
                  "description": "The effective start date of the subscription; can be past, current, or future. Date must be provided in ISO 8601 format"
                }
              ]
            }
          }
        }
      ]
    },
    "UsageBasedCharge": {
      "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"
        },
        "properties": {
          "type": "object",
          "description": "Pricing thresholds that determine the charges"
        },
        "taxes": {
          "type": "array",
          "description": "List of tax entities configured for the usage based charge.",
          "items": {
            "$ref": "#/$defs/TaxResponse"
          }
        },
        "min_amount": {
          "allOf": [
            {
              "$ref": "#/$defs/Amount"
            }
          ]
        }
      }
    }
  }
}