# Upsert an order change

`PUT /order-changes/{id}`

> This is a subset of the full specification, limited to the `PUT /order-changes/{id}` operation.
>
> You can find the full specification here: /_bundle/docs/dev-docs/api/index.yaml

```yaml
openapi: 3.1.1
info:
  version: latest
  title: Core APIs
  contact:
    name: Rebilly API Support
    url: https://www.rebilly.com/contact/
    email: integrations@rebilly.com
  license:
    name: Rebilly
    url: https://www.rebilly.com/api-license/
  termsOfService: https://www.rebilly.com/terms-of-use/
  x-logo:
    url: https://rebilly-core.redoc.ly/rb_apiLogo.svg
    backgroundColor: '#0044d4'
  description: This is a subset of the full specification, limited to the `PUT /order-changes/{id}` operation. Components more than 3 `$ref` hops away are not included.
  x-metadata:
    description: The most common APIs used to automate common workflows.
    redocly_category: API Reference
servers:
  - url: https://api-sandbox.rebilly.com/organizations/{organizationId}
    description: Sandbox server
    variables:
      organizationId:
        default: '{organizationId}'
        description: |-
          Unique organization identifier.
          An organization is an entity that represents a company.
          For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
  - url: https://api.rebilly.com/organizations/{organizationId}
    description: Live server
    variables:
      organizationId:
        default: '{organizationId}'
        description: |-
          Unique organization identifier.
          An organization is an entity that represents a company.
          For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
security:
  - SecretApiKey: []
  - JWT: []
tags:
  - name: Orders
    description: Use these operations to manage orders that include items with mixed recurring subscription plans.
x-tagGroups:
  - name: Orders & Invoices
    tags:
      - Orders
paths:
  /order-changes/{id}:
    parameters:
      - $ref: '#/components/parameters/resourceId'
    put:
      x-products:
        - Core
      tags:
        - Orders
      summary: Upsert an order change
      operationId: PutOrderChange
      x-sdk-operation-name: update
      description: |-
        Creates an order change with a specified ID, or replaces the items of a pending order change.
        A change that is not pending cannot be updated.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderChange'
      responses:
        '200':
          description: Order change updated.
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderChange'
        '201':
          description: Order change created.
          headers:
            Location:
              $ref: '#/components/headers/Location'
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderChange'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          description: Order change rejected, or the change is not pending.
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  securitySchemes:
    JWT:
      description: |-
        JWT is a short lifetime token that can be assigned a specific expiration time.

        Usage format: `Bearer <JWT>`.
      type: http
      scheme: bearer
      bearerFormat: JWT
    SecretApiKey:
      description: |-
        Never share your secret keys.
        Keep them guarded and secure.

        Use your secret API key only to make requests from the server side.
        To authenticate, provide your secret key in the request header.
      name: REB-APIKEY
      type: apiKey
      in: header
  parameters:
    resourceId:
      name: id
      in: path
      description: ID of the resource.
      required: true
      schema:
        type: string
        maxLength: 50
        pattern: ^[@~\-\.\w]+$
  headers:
    Location:
      description: Location of the related resource.
      schema:
        type: string
        format: uri
      example: https://api.rebilly.com/example
    Rate-Limit-Limit:
      description: |-
        Maximum number of requests available at one time for this rate limit.
        For more information, see [Rate limits](#section/Rate-limits).
      schema:
        type: integer
      example: 500
    Rate-Limit-Remaining:
      description: |-
        Number of requests still available for this rate limit.
        For more information, see [Rate limits](#section/Rate-limits).
      schema:
        type: integer
      example: 499
    Rate-Limit-Retry-After:
      description: Number of seconds to wait before retrying the request.
      schema:
        type: integer
      example: 1
  schemas:
    CreatedTime:
      type: string
      description: |-
        Date and time when the resource is created.
        This value is set automatically when the resource is created.
      format: date-time
      readOnly: true
      x-sortable: true
      x-label: Creation Time
    UpdatedTime:
      type: string
      description: |-
        Date and time when the resource is updated.
        This value is set automatically when the resource is updated.
      format: date-time
      readOnly: true
      x-sortable: true
      x-label: Last Update Time
    ResourceId:
      type: string
      description: Unique resource ID.
      maxLength: 50
      example: 4f6cf35x-2c4y-483z-a0a9-158621f77a21
    SelfLink:
      type: array
      description: Related links.
      readOnly: true
      items:
        type: object
        properties:
          href:
            description: Link URL.
            type: string
          rel:
            description: Type of link.
            type: string
            enum:
              - self
    BaseProblem:
      type: object
      additionalProperties: true
      minProperties: 1
      description: RFC-7807 [problem details](https://tools.ietf.org/html/rfc7807) JSON object.
      properties:
        type:
          type: string
          description: |-
            Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference.
            It should provide human-readable documentation for the problem type.
            When this member is not present, its value is assumed to be "about:blank".
          format: uri
        title:
          type: string
          description: |-
            Short, human-readable summary of the problem type.
            Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem.
        detail:
          type: string
          description: Human-readable explanation that is specific to this occurrence of the problem.
        instance:
          type: string
          description: |-
            URI reference that identifies the specific occurrence of the problem.
            It may or may not yield further information if dereferenced.
    Unauthorized:
      allOf:
        - title: Unauthorized
        - type: object
          properties:
            status:
              type: integer
              description: HTTP status code.
              minimum: 401
              maximum: 401
        - $ref: '#/components/schemas/BaseProblem'
    OrganizationId:
      type: string
      description: |-
        Unique organization identifier.
        An organization is an entity that represents a company.
        For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
      maxLength: 50
      example: org_0YVDM8RC7GDADADSBSMW124JA8
    Forbidden:
      allOf:
        - title: Forbidden
        - type: object
          properties:
            status:
              type: integer
              description: HTTP status code.
              minimum: 403
              maximum: 403
            error:
              type: string
              description: |-
                Message that describes why the request is forbidden.
                Most responses use a descriptive message, such as `Not allowed to change security settings`.
                If the organization requires multi-factor authentication (MFA) and MFA verification has not been completed for the session, this value is `mfa_required`.
                If MFA verification has not been completed for the session and the operation requires a confirmed session, this value is `mfa_required_for_caller`.
                This includes turning on `requireMfa` and resetting MFA for a user.
                If the organization restricts access to a list of IP addresses and the request comes from an IP address that is not in the list, this value is `ip_not_allowed`.
            organizationId:
              description: |-
                ID of the organization that requires MFA or does not allow the IP address of the request.
                This property is present only if `error` is `mfa_required` or `ip_not_allowed`.
                The organization is the organization of the request or another organization that the request acts on.
              $ref: '#/components/schemas/OrganizationId'
        - $ref: '#/components/schemas/BaseProblem'
    InvalidFields:
      type: array
      description: Invalid field details.
      items:
        type: object
        properties:
          field:
            type: string
            description: |-
              Name of the field.
              Dot notation is used for nested object field names.
          message:
            description: Message field.
            type: string
      example:
        - field: field1
          message: field1 is invalid
        - field: subObject.field2
          message: field2 is invalid
        - field: subObject.field2
          message: another error in the field2
    ValidationError:
      allOf:
        - title: Validation error
        - type: object
          properties:
            status:
              type: integer
              description: HTTP status code.
              minimum: 422
              maximum: 422
        - $ref: '#/components/schemas/BaseProblem'
        - type: object
          properties:
            invalidFields:
              $ref: '#/components/schemas/InvalidFields'
    TooManyRequests:
      type: object
      additionalProperties: true
      minProperties: 1
      description: RFC-7807 [problem details](https://tools.ietf.org/html/rfc7807) JSON object.
      properties:
        type:
          type: string
          description: |-
            Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference.
            It should provide human-readable documentation for the problem type.
            When this member is not present, its value is assumed to be "about:blank".
          format: uri
          example: about:blank
        title:
          type: string
          description: |-
            Short, human-readable summary of the problem type.
            Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem.
          example: Rate Limit Exceeded
        status:
          type: integer
          description: HTTP status code.
          minimum: 429
          maximum: 429
        detail:
          type: string
          description: Human-readable explanation that is specific to this occurrence of the problem.
          example: A request cannot be executed because the user has sent too many requests within a certain period of time
        instance:
          type: string
          description: |-
            URI reference that identifies the specific occurrence of the problem.
            It may or may not yield further information if dereferenced.
    Conflict:
      allOf:
        - title: Conflict
        - type: object
          properties:
            status:
              type: integer
              description: HTTP status code.
              minimum: 409
              maximum: 409
        - $ref: '#/components/schemas/BaseProblem'
    SubscriptionPlan:
      title: SubscriptionPlan
      description: |-
        Details of the subscription order plan.
        Use this plan for subscriptions or sales that reoccur over a period of time.
      type: object
      required:
        - name
        - currency
        - productId
        - pricing
        - recurringInterval
      properties:
        type:
          type: string
          description: |-
            Variant of the plan.
            This field is optional in create and update requests.
            The variant is `subscription` when `recurringInterval` is present.
            If included, this field must match the applicable variant.
            A mismatch results in an HTTP `422` response.
            Responses always include this field.
          enum:
            - subscription
        name:
          description: |-
            Name of the plan.
            This name is displayed on invoices and receipts.
          type: string
          maxLength: 255
        description:
          type: string
          description: |-
            Plain-text description of the plan.
            This field accepts plain-text only.
          maxLength: 65535
        richDescription:
          type: string
          description: |-
            Rich-text description of the plan.
            This field accepts rich text formatting, such as: bold, underline, italic, and hyperlinks.
          maxLength: 65535
        productId:
          type: string
          description: ID of the related product.
          maxLength: 50
          example: prod_0YV7DES3WPC5J8JD8QTVNZBZNZ
        productOptions:
          type:
            - object
            - 'null'
          description: Name-value pairs that specify the product options.
          additionalProperties:
            type: string
          example:
            region: US
            size: xxl
        currency:
          $ref: '#/components/schemas/CurrencyCode'
        currencySign:
          description: Currency sign.
          readOnly: true
          type: string
        pricing:
          $ref: '#/components/schemas/PlanPriceFormula'
        setup:
          $ref: '#/components/schemas/PlanSetup'
        setupFee:
          $ref: '#/components/schemas/PlanSetupFee'
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
        isActive:
          type: boolean
          description: Specifies if the plan is active.
          default: true
        revision:
          type: integer
          readOnly: true
          description: |-
            Number of times the plan is modified.
            Compare this value with materialized subscription item revision values.
        isTrialOnly:
          type: boolean
          const: false
          description: Specifies if a plan is a trial that does not have recurring instructions.
          readOnly: true
        recurringInterval:
          description: Service interval settings.
          type: object
          required:
            - unit
            - length
          properties:
            periodAnchorInstruction:
              $ref: '#/components/schemas/ServicePeriodAnchorInstruction'
            unit:
              description: Unit of time.
              type: string
              enum:
                - day
                - week
                - month
                - year
            length:
              description: Length of time.
              type: integer
              minimum: 1
            limit:
              description: |-
                Number of invoices the subscription order generates.
                If this value is `1`, only the initial order creation is generated.

                Example: For a 1 year contract that is billed monthly,
                where the `periodUnit` is `month` and the `periodDuration` is `1`,
                set this field to `12`.
              type:
                - integer
                - 'null'
              minimum: 1
              maximum: 65535
            billingTiming:
              type: string
              default: prepaid
              description: |-
                Billing timing in relation to the service period.
                For `prepaid` plans the customer pays when the service period starts,
                whereas, for `postpaid` plans, the customer pays when the service period ends.
              enum:
                - prepaid
                - postpaid
        trial:
          description: |-
            Trial configuration setting.
            If you do not want to offer a trial, set this value to `null`.
          $ref: '#/components/schemas/PlanTrial'
        meteredBilling:
          type:
            - object
            - 'null'
          required:
            - strategy
          description: |-
            Use metered billing when an exact quantity is unknown.
            Report usage during a service period and charge customers afterwards.
            Metered billing plans must be postpaid.
          properties:
            strategy:
              type: string
              enum:
                - sum
                - last
              x-enumDescriptions:
                sum: Total amount of reported invoice item quantity usage.
                last: Last reported invoice item quantity usage.
            min:
              description: Minimum quantity that is charged at the end of a service period regardless of reported usage.
              type:
                - number
                - 'null'
              format: float
              minimum: 0.01
            max:
              description: Maximum quantity that is charged at the end of a service period regardless of reported usage.
              type:
                - number
                - 'null'
              format: float
              minimum: 0.01
            sticky:
              description: |-
                When enabled, if no usage is reported during a service period,
                the plan bills the last known reported quantity from a previous period instead of zero.
                This is suitable for hosted or persistent resources with usage that does not change every period.
                Only supported with `strategy`: `last`.
              type: boolean
              default: false
              example: false
        invoiceTimeShift:
          readOnly: true
          deprecated: true
          $ref: '#/components/schemas/InvoiceTimeShift'
        createdTime:
          $ref: '#/components/schemas/CreatedTime'
        updatedTime:
          $ref: '#/components/schemas/UpdatedTime'
        _links:
          type: array
          description: Related links.
          readOnly: true
          items:
            type: object
            properties:
              href:
                description: Link URL.
                type: string
              rel:
                description: Type of link.
                type: string
                enum:
                  - self
                  - attachments
    OneTimeSalePlan:
      title: OneTimeSalePlan
      type: object
      description: |-
        Details of the one-time sale plan.
        Use this plan for non-recurring, one-time, sales.
      required:
        - name
        - currency
        - productId
        - pricing
      properties:
        type:
          type: string
          description: |-
            Variant of the plan.
            This field is optional in create and update requests.
            The variant is `one-time-sale` when both `recurringInterval` and `trial` are omitted.
            If included, this field must match the applicable variant.
            A mismatch results in an HTTP `422` response.
            Responses always include this field.
          enum:
            - one-time-sale
        name:
          description: |-
            Name of the plan.
            This name is displayed on invoices and receipts.
          type: string
          maxLength: 255
        description:
          type: string
          description: |-
            Plain-text description of the plan.
            This field accepts plain-text only.
          maxLength: 65535
        richDescription:
          type: string
          description: |-
            Rich-text description of the plan.
            This field accepts rich text formatting, such as: bold, underline, italic, and hyperlinks.
          maxLength: 65535
        productId:
          type: string
          description: ID of the related product.
          maxLength: 50
          example: prod_0YV7DES3WPC5J8JD8QTVNZBZNZ
        productOptions:
          type:
            - object
            - 'null'
          description: Name-value pairs that specify the product options.
          additionalProperties:
            type: string
          example:
            region: US
            size: xxl
        currency:
          $ref: '#/components/schemas/CurrencyCode'
        currencySign:
          description: Currency sign.
          readOnly: true
          type: string
        pricing:
          $ref: '#/components/schemas/PlanPriceFormula'
        setup:
          $ref: '#/components/schemas/PlanSetup'
        setupFee:
          $ref: '#/components/schemas/PlanSetupFee'
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
        isActive:
          type: boolean
          description: Specifies if the plan is active.
          default: true
        revision:
          type: integer
          readOnly: true
          description: |-
            Number of times the plan is modified.
            Compare this value with materialized subscription item revision values.
        isTrialOnly:
          type: boolean
          const: false
          description: Specifies if a plan is a trial that does not have recurring instructions.
          readOnly: true
        recurringInterval:
          type: 'null'
          description: Service interval settings.
          readOnly: true
        trial:
          type: 'null'
          description: Trial configuration setting.
          readOnly: true
        createdTime:
          $ref: '#/components/schemas/CreatedTime'
        updatedTime:
          $ref: '#/components/schemas/UpdatedTime'
        _links:
          type: array
          description: Related links.
          readOnly: true
          items:
            type: object
            properties:
              href:
                description: Link URL.
                type: string
              rel:
                description: Type of link.
                type: string
                enum:
                  - self
                  - attachments
    TrialOnlyPlan:
      title: TrialOnlyPlan
      description: |-
        Details of the trial-only plan.
        Use this plan for limited-time product trials.
        Trials may have a reduced fee, or may be free.
      type: object
      required:
        - name
        - currency
        - productId
        - trial
      properties:
        type:
          type: string
          description: |-
            Variant of the plan.
            This field is optional in create and update requests.
            The variant is `trial-only` when `trial` is present without `recurringInterval`.
            If included, this field must match the applicable variant.
            A mismatch results in an HTTP `422` response.
            Responses always include this field.
          enum:
            - trial-only
        name:
          description: |-
            Name of the plan.
            This name is displayed on invoices and receipts.
          type: string
          maxLength: 255
        description:
          type: string
          description: |-
            Plain-text description of the plan.
            This field accepts plain-text only.
          maxLength: 65535
        richDescription:
          type: string
          description: |-
            Rich-text description of the plan.
            This field accepts rich text formatting, such as: bold, underline, italic, and hyperlinks.
          maxLength: 65535
        productId:
          type: string
          description: ID of the related product.
          maxLength: 50
          example: prod_0YV7DES3WPC5J8JD8QTVNZBZNZ
        productOptions:
          type:
            - object
            - 'null'
          description: Name-value pairs that specify the product options.
          additionalProperties:
            type: string
          example:
            region: US
            size: xxl
        currency:
          $ref: '#/components/schemas/CurrencyCode'
        currencySign:
          description: Currency sign.
          readOnly: true
          type: string
        setup:
          $ref: '#/components/schemas/PlanSetup'
        setupFee:
          $ref: '#/components/schemas/PlanSetupFee'
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
        isActive:
          type: boolean
          description: Specifies if the plan is active.
          default: true
        revision:
          type: integer
          readOnly: true
          description: |-
            Number of times the plan is modified.
            Compare this value with materialized subscription item revision values.
        isTrialOnly:
          type: boolean
          const: true
          description: Specifies if a plan is a trial that does not have recurring instructions.
          readOnly: true
        recurringInterval:
          type: 'null'
          description: Service interval settings.
          readOnly: true
        trial:
          description: Trial configuration settings.
          allOf:
            - type: object
            - $ref: '#/components/schemas/PlanTrial'
        invoiceTimeShift:
          readOnly: true
          deprecated: true
          description: |-
            Use invoice time shift to adjust the invoice issue and due date when billing must occur before the service period changes.
            For example, rent must be paid in advance,
            so the invoice must be in advance of the billing date.
            For more information, see [Service period anchor, billing timing, and invoice time shift](https://www.rebilly.com/docs/dev-docs/subscriptions#service-period-anchor-billing-timing-and-invoice-time-shift).
          $ref: '#/components/schemas/InvoiceTimeShift'
        createdTime:
          $ref: '#/components/schemas/CreatedTime'
        updatedTime:
          $ref: '#/components/schemas/UpdatedTime'
        _links:
          type: array
          description: Related links.
          readOnly: true
          items:
            type: object
            properties:
              href:
                description: Link URL.
                type: string
              rel:
                description: Type of link.
                type: string
                enum:
                  - self
                  - attachments
    OriginalPlan:
      type: object
      description: |-
        Use an existing plan without changes for the current order.

        To create a new plan, see [Create a plan](https://www.rebilly.com/catalog/all/plans/postplan).
      required:
        - id
      additionalProperties: false
      properties:
        id:
          description: ID of the plan.
          $ref: '#/components/schemas/ResourceId'
    FlexiblePlan:
      oneOf:
        - allOf:
            - type: object
              required:
                - id
              properties:
                id:
                  type: string
                  description: ID of the plan.
                  maxLength: 50
                  example: plan_0YV7DENSVGDBW9S71XZNNYYQ0X
            - $ref: '#/components/schemas/OneTimeSalePlan'
        - allOf:
            - type: object
              required:
                - id
              properties:
                id:
                  type: string
                  description: ID of the plan.
                  maxLength: 50
                  example: plan_0YV7DENSVGDBW9S71XZNNYYQ0X
            - $ref: '#/components/schemas/SubscriptionPlan'
        - allOf:
            - type: object
              required:
                - id
              properties:
                id:
                  type: string
                  description: ID of the plan.
                  maxLength: 50
                  example: plan_0YV7DENSVGDBW9S71XZNNYYQ0X
            - $ref: '#/components/schemas/TrialOnlyPlan'
    UsageLimits:
      type: object
      description: |-
        Specifies the soft and hard usage limit thresholds for an item with a metered billing plan.
        This value is ignored when the plan is not metered.
      properties:
        softLimit:
          type: object
          description: |-
            Defines thresholds for notification purposes.
            For example, to notify the customer that their usage is near the hard limit of their metered billing plan.
            This notification informs the customer so that they can upgrade their plan before the hard limit is reached.
            When metered usage equals or exceeds the configured soft limit, the `soft-usage-limit-reached` event is triggered.

            The quantity limit applies to the larger of the reported and billed quantity.
            If a minimum billable quantity results in a billed quantity that is higher than the reported quantity, the billed quantity applies to the limit.
            If a maximum billable quantity results in a billed quantity that is lower than the reported quantity, the reported quantity applies to the limit.
            The amount limit applies to the billed amount.

            To notify the customer, a webhook and notification can be configured for this event.
            This field is useful for accounting and customer success purposes.
            The usage of metered billing plans can still be reported if the soft limit is reached.
          minProperties: 1
          maxProperties: 1
          properties:
            quantity:
              type: integer
              description: Usage limit quantity.
              minimum: 0
            amount:
              type: number
              format: double
              description: Usage limit amount in the currency of the order.
              minimum: 0
        hardLimit:
          type: object
          description: |-
            Defines a limit where the customer can no longer use the service.
            Hard limits are used in addition to soft limits.
            When a soft limit is reached,
            a customer may receive a notification
            but the service can still be provided up to the hard limit value so that the customer can upgrade their plan.

            When the reported usage reaches the configured limit,
            a specific event is triggered.
            To notify the customer in the merchant system,
            or block a service,
            a webhook and notification can be configured for this event.
            When the total usage reaches the hard limit quantity,
            or amount values,
            metered billing plan usages can no longer be reported.

            Plans with a minimum quantity, fixed fee, or flat stairstep bracket set a minimum billable quantity and amount.
            A `quantity` value below the minimum billable quantity is invalid.
            An `amount` value below the minimum billable amount is invalid.
            A `0` value remains valid even on plans with minimum billing.
          minProperties: 1
          maxProperties: 1
          properties:
            quantity:
              type: integer
              description: Usage limit quantity.
              minimum: 0
            amount:
              type: number
              format: double
              description: Usage limit amount in the currency of the order.
              minimum: 0
        trialLimit:
          oneOf:
            - type: number
              format: double
              minimum: 0
            - type: 'null'
          description: |-
            Defines a usage cap during the trial period of a subscription.
            This limit is enforced only while the subscription is in its trial phase.
            When the reported usage reaches the configured trial limit, an event called 'trial-usage-limit-reached' is triggered.
            To notify the customer or restrict access to the service, a webhook and notification can be configured for this event.
            When the trial limit is reached, additional usage cannot be reported unless the trial ends.
          example: 20.725
    OrderChange:
      type: object
      description: |-
        Change to the items of a recurring order.
        A change with `applyAt` set to `now` replaces the items immediately.
        A change with `applyAt` set to `nextRenewal` records the new items and applies them at the next renewal.
        The current items remain until the next renewal, when the new items are applied and billed on the renewal invoice.

        This resource records changes made through this resource and changes created by a quote with `applyAt` set to `nextRenewal`.
        Changes made through the `POST /orders/{id}/change-items` operation or through a quote with `applyAt` set to `now` are not recorded.
        A change with `applyAt` set to `now` triggers the `order-change-created` and `order-change-applied` events and the item events of the order.
      required:
        - orderId
        - items
      properties:
        id:
          description: ID of the order change.
          type: string
          maxLength: 50
          readOnly: true
          example: ord_chg_0YV7DES3WPC5J8JD8QTVNZBZQ8
        orderId:
          description: ID of the order.
          type: string
          maxLength: 50
          example: ord_01HRF27SATGE4Z6PBJE6PD8328
        status:
          description: Status of the order change.
          type: string
          readOnly: true
          enum:
            - pending
            - applied
            - canceled
            - superseded
          x-enumDescriptions:
            pending: Scheduled to apply at the next renewal.
            applied: Items of the order are replaced.
            canceled: Canceled before the change is applied.
            superseded: Replaced by a later change for the same order.
        applyAt:
          description: |-
            Time when the new items are applied.

            - `now`: The items change immediately.
              `renewalPolicy`, `prorated`, and `effectiveTime` apply.
            - `nextRenewal`: The current items stay until the next renewal.
              The new items are billed on the next renewal invoice.
              `renewalPolicy`, `prorated`, and `effectiveTime` are not allowed.
              A later change for the same order supersedes the pending change.
              The pending change is locked when the next renewal invoice is issued.
              To remove a pending change, use the `DELETE /order-changes/{id}` operation.
              The new items must differ from the current items.
              One-time sale items that are already on the order remain.
              A one-time sale item cannot be added with `nextRenewal`.
          type: string
          enum:
            - now
            - nextRenewal
          default: now
        effectiveTime:
          description: |-
            Date and time when the change is applied.
            If `applyAt` is set to `now`, this value is the date from which the renewal time for `resetToRecurring` and the proration are calculated.
            If this field is omitted, this value defaults to the current time.
            If `applyAt` is set to `nextRenewal`, this value is read-only and equals the renewal time of the order.
          type: string
          format: date-time
        lockedTime:
          description: |-
            Date and time when the items of a pending change are billed.
            After this time, the change is locked and cannot be modified until the renewal.
          type:
            - string
            - 'null'
          format: date-time
          readOnly: true
        appliedTime:
          description: Date and time when the items of the order are replaced.
          type:
            - string
            - 'null'
          format: date-time
          readOnly: true
        quoteId:
          description: |-
            ID of the quote that is used to create the change.
            This value is `null` if the change is not created from a quote.
          type:
            - string
            - 'null'
          maxLength: 50
          readOnly: true
        items:
          description: |-
            New items for the order.
            To remove an item, include the items array and exclude the items you want to remove.
          type: array
          minItems: 1
          items:
            type: object
            required:
              - plan
            properties:
              plan:
                description: Plan details.
                oneOf:
                  - $ref: '#/components/schemas/OriginalPlan'
                  - $ref: '#/components/schemas/FlexiblePlan'
              quantity:
                description: Number of units of the product on the specified plan.
                type: integer
              usageLimits:
                oneOf:
                  - $ref: '#/components/schemas/UsageLimits'
                  - type: 'null'
              excludeFromMrr:
                description: Specifies if this item is excluded from monthly recurring revenue calculations.
                type:
                  - boolean
                  - 'null'
        renewalPolicy:
          description: |-
            How the service periods and trial state of the order are managed when its items change now.
            Required when `applyAt` is `now`.
            Not allowed when `applyAt` is `nextRenewal`.
          type: string
          enum:
            - resetToRecurring
            - retainRecurring
            - retainTrialThenRecurring
            - retainTrialOnly
          x-enumDescriptions:
            resetToRecurring: Resets the service periods, ends any trial, and converts trial-only items to recurring.
            retainRecurring: Retains the current service periods, ends any trial, and converts trial-only items to recurring.
            retainTrialThenRecurring: |-
              Retains the trial until it ends, then converts the item to recurring.
              Returns a validation error if the order has no trial.
            retainTrialOnly: |-
              Retains the trial and keeps the item as trial-only.
              Returns a validation error if the order is not trial-only.
        prorated:
          description: |-
            Specifies whether to give a pro rata credit for the amount of time remaining between the `effectiveTime` and the end of the current period.
            Required when `applyAt` is `now`.
            Not allowed when `applyAt` is `nextRenewal`.

            If `renewalTime` is retained by setting `renewalPolicy` to `retainRecurring`, `retainTrialThenRecurring`, or `retainTrialOnly`,
            a pro rata debit is also applied for the time between `effectiveTime` and `renewalTime`, as a percentage of the normal period size.
          type: boolean
        createdTime:
          $ref: '#/components/schemas/CreatedTime'
        updatedTime:
          $ref: '#/components/schemas/UpdatedTime'
        _links:
          $ref: '#/components/schemas/SelfLink'
  responses:
    Unauthorized:
      description: |-
        Unauthorized access.
        Invalid credentials used.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Unauthorized'
    Forbidden:
      description: |-
        Access forbidden.
        If the organization requires multi-factor authentication (MFA) and the session has not passed MFA, `error` is `mfa_required`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Forbidden'
    ValidationError:
      description: Invalid data sent.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
    TooManyRequests:
      description: Request rate limit exceeded.
      headers:
        Rate-Limit-Limit:
          $ref: '#/components/headers/Rate-Limit-Limit'
        Rate-Limit-Remaining:
          description: |-
            Number of requests still available for this rate limit.
            For more information, see [Rate limits](#section/Rate-limits).
          schema:
            type: integer
          example: 0
        Rate-Limit-Retry-After:
          $ref: '#/components/headers/Rate-Limit-Retry-After'
        Retry-After:
          description: Number of seconds to wait before retrying the request.
          schema:
            type: integer
          example: 1
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/TooManyRequests'
    Conflict:
      description: Conflict.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Conflict'
```
