# Retrieve an order change

Retrieves an order change with a specified ID.

Endpoint: GET /order-changes/{id}
Version: latest
Security: SecretApiKey, JWT

## Security:

  - `SecretApiKey` (unknown)
    apiKey in header REB-APIKEY

  - `JWT` (unknown)
    http bearer JWT

## Path parameters:

  - `id` (string, required)
    ID of the resource.

## Response 200:

  - `200` (unknown)
    Order change retrieved.

## Response 200 fields (application/json):

  - `id` (string)
    ID of the order change.
    Example: ord_chg_0YV7DES3WPC5J8JD8QTVNZBZQ8

  - `orderId` (string, required)
    ID of the order.
    Example: ord_01HRF27SATGE4Z6PBJE6PD8328

  - `status` (string)
    Status of the order change.
    Enum: "pending", "applied", "canceled", "superseded"

  - `applyAt` (string)
    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 once 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`.
    Enum: "now", "nextRenewal"

  - `effectiveTime` (string)
    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.

  - `lockedTime` (string | null)
    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.

  - `appliedTime` (string | null)
    Date and time when the items of the order are replaced.

  - `quoteId` (string | null)
    ID of the quote that is used to create the change.
This value is `null` if the change is not created from a quote.

  - `items` (array, required)
    New items for the order.
To remove an item, include the items array and exclude the items you want to remove.

  - `items.plan` (any, required)
    Plan details.

  - `items.plan.id` (string, required)
    Unique resource ID.
    Example: 4f6cf35x-2c4y-483z-a0a9-158621f77a21

  - `items.plan.id` (string, required)
    ID of the plan.
    Example: plan_0YV7DENSVGDBW9S71XZNNYYQ0X

  - `items.plan.type` (string)
    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"

  - `items.plan.name` (string, required)
    Name of the plan.
This name is displayed on invoices and receipts.

  - `items.plan.description` (string)
    Plain-text description of the plan.
This field accepts plain-text only.

  - `items.plan.richDescription` (string)
    Rich-text description of the plan.
This field accepts rich text formatting, such as: bold, underline, italic, and hyperlinks.

  - `items.plan.productId` (string, required)
    ID of the related product.
    Example: prod_0YV7DES3WPC5J8JD8QTVNZBZNZ

  - `items.plan.productOptions` (object | null)
    Name-value pairs that specify the product options.
    Example: {"color":"red","size":"xxl"}

  - `items.plan.currency` (string, required)
    Currency code in ISO 4217 format.
    Example: USD

  - `items.plan.currencySign` (string)
    Currency sign.

  - `items.plan.pricing` (object, required)
    Pricing details.

  - `items.plan.pricing.formula` (string, required)
    Price formula that determines which algorithm is used to calculate the invoice price based on the following factors:
- Quantity in the order.
This value may be variable if you are charging based on usage.
If you are not charging based on usage,
this value is determined when an order is created.
- Price of the quantity range.
Some formulas set a price based on defined product quantity ranges.

For more information, see [Price formulas](https://www.rebilly.com/docs/billing/pricing-formulas/).
    Enum: "fixed-fee"

  - `items.plan.pricing.price` (number, required)
    Use this formula to charge for subscriptions that have a fixed price,
number of units, and reoccur over a fixed period of time,
such as every: day, week, month, year, or number of years.
For example, a streaming company charges customers $13.99 each month for subscription period that is 6 months in duration.
The quantity of movies that a customer streams each month does not impact the price.
    Example: 99.95

  - `items.plan.pricing.price` (number, required)
    Use this formula to charge a flat fee per unit.
For example, $0.10 for each transaction or $4 per unit.
If the value of this field is `0`, the product is free.
    Example: 99.95

  - `items.plan.pricing.minQuantity` (integer | null)
    Minimum permitted unit quantity.
If this value is `null`, no limit is in place.
    Example: 1

  - `items.plan.pricing.maxQuantity` (integer | null)
    Maximum permitted unit quantity.
If this value is `null`, no limit is in place.
    Example: 1

  - `items.plan.pricing.brackets` (array, required)
    Use this formula to charge for units that are sold in specific quantity ranges.
For example, a bank charges a merchant based on the number of transactions they complete each month.
| Price total | Max quantity | Description |
|  --- | --- | --- |
| $50 | 1000 | Up to 1000 transactions |
| $100 | 1500 | Between 1000 and 1500 transactions |
| $200 | 3000 | Between 1500 and 3000 transactions |
| $500 | null | More than 3000 transactions |

- If the merchant completes 900 transaction in a month, they are charged $50.
- If the merchant completes 1001 transaction in a month, they are charged $100.
- If the merchant completes 2500  transaction in a month, they are charged $200.
- If the merchant completes more than 3000 transaction in a month, they are charged $500.

  - `items.plan.pricing.brackets.price` (number)
    Price of the quantity range.
If the value of this field is `0`, the product is free.
    Example: 99.95

  - `items.plan.pricing.brackets.maxQuantity` (integer | null)
    Maximum permitted unit quantity.
If this value is `null`, no limit is in place.
This value starts from the end of the previous quantity range.
If there are no previous quantity ranges,
this value starts at 1.
    Example: 1

  - `items.plan.pricing.brackets` (array, required)
    Use this formula to charge for units that are sold within defined quantity ranges, or tiers.
If a customer buys a number of units that span more than one tier,
the total cost is calculated based on the cost of the units in each tier.
For example, a software company sells user licenses based on the following:
| Tier | Price per user | Max quantity | Description |
|  --- | --- | --- | --- |
| 1 | $40 | 3 | 1 to 3 user licenses |
| 2 | $30 | 5 | 5 to 8 user licenses |
| 3 | $15 | null | 9 or more user licenses |

If a customer buys 10 user licenses, the pricing is as follows:
- 3 licenses at tier 1 (3 x $40) is 120
- 5 licenses at tier 2 (5 x $30) is 150
- 2 licenses at tier 3 (2 x $15) is 30

Total cost = $330
Formula: `(price for the tier x quantity within the tier)` + `(price for next tier x quantity in next tier)` + `...` = final price.

  - `items.plan.pricing.brackets` (array, required)
    Use this formula to charge for units that are sold in bulk, or volume ranges.
This formula enables customers to pays less per unit when they buy a large volume of units.
Unit cost is based on the highest volume range, and does not include lower volume range pricing.
For example, a company sells t-shirts in the following volume ranges:
| Price per unit | Max quantity | Description |
|  --- | --- | --- |
| $10 | 1 | 1 t-shirt |
| $8 | 5 | 2 to 5 t-shirts |
| $4 | null | 6 or more t-shirts |

- If a customer buys 1 unit, they pay $10.
- If a customer buys 3 units, they pay $24 per unit, which is $8 per unit.
- If a customer buys 10 units, they pay $40, which is $4 per unit.

  - `items.plan.setup` (object | null)
    Setup fee information for the plan.

  - `items.plan.setup.price` (number, required)
    One-time setup fee charged when the plan starts.
This field is deprecated.
Use the `setupFee` field instead.

  - `items.plan.setupFee` (number | null)
    One-time setup fee charged when the plan starts.
Set to `0` or `null` if no setup fee applies.
    Example: 0

  - `items.plan.customFields` (object)
    Use custom fields to extend a resource scheme to include custom data that is not provided as a common field.
For more information, see [Custom fields](https://www.rebilly.com/catalog/all/custom-fields).
    Example: {"foo":"bar"}

  - `items.plan.isActive` (boolean)
    Specifies if the plan is active.

  - `items.plan.revision` (integer)
    Number of times the plan is modified.
Compare this value with materialized subscription item revision values.

  - `items.plan.isTrialOnly` (boolean)
    Specifies if a plan is a trial that does not have recurring instructions.

  - `items.plan.recurringInterval` (null)
    Service interval settings.

  - `items.plan.trial` (null)
    Trial configuration setting.

  - `items.plan.createdTime` (string)
    Date and time when the resource is created.
This value is set automatically when the resource is created.

  - `items.plan.updatedTime` (string)
    Date and time when the resource is updated.
This value is set automatically when the resource is updated.

  - `items.plan._links` (array)
    Related links.

  - `items.plan._links.href` (string)
    Link URL.

  - `items.plan._links.rel` (string)
    Type of link.
    Enum: "self", "attachments"

  - `items.plan.type` (string)
    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"

  - `items.plan.trial` (object | null)

  - `items.plan.trial.price` (number, required)
    Price of setting up a trial.
If your service charges a fee for a trial, specify it here.
To charge no trial fee, set this value to `0`.

  - `items.plan.trial.period` (object, required)
    Period information.

  - `items.plan.trial.period.unit` (string, required)
    Unit of time.
    Enum: "day", "week", "month", "year"

  - `items.plan.trial.period.length` (integer, required)
    Length of time.

  - `items.plan.meteredBilling` (object | null)
    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.

  - `items.plan.meteredBilling.strategy` (string, required)
    Enum: "sum", "last"

  - `items.plan.meteredBilling.min` (number | null)
    Minimum quantity that is charged at the end of a service period regardless of reported usage.

  - `items.plan.meteredBilling.max` (number | null)
    Maximum quantity that is charged at the end of a service period regardless of reported usage.

  - `items.plan.meteredBilling.sticky` (boolean)
    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 whose usage does not change every period.
Only supported with `strategy`: `last`.
    Example: false

  - `items.plan.invoiceTimeShift` (object | null)
    Use invoice time shift to control the billing time.
Invoice time shift adjusts the invoice issue and due date when billing must occur before the service period changes.
Use invoice time shift in conjunction with `billingTiming` to:
- Bill immediately when the service period starts.
- Bill immediately after the service period ends.
- Bill at an interval of time before the service period starts.
- Bill at an interval of time after the service period starts.
- Bill at an interval of time before the service period ends.
- Bill at an interval of time after the service period ends.

  - `items.plan.invoiceTimeShift.issueTimeShift` (object)
    Calculation instruction of the billing time.
This is used in conjunction with the service period anchor to calculate
the time at which the invoice is issued. 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).

  - `items.plan.invoiceTimeShift.issueTimeShift.chronology` (string, required)
    Sequential order of the billing time relative to the start of the service period.
    Enum: "before"

  - `items.plan.invoiceTimeShift.issueTimeShift.duration` (integer, required)
    Amount of time by which to move the invoice issue time or date.

  - `items.plan.invoiceTimeShift.issueTimeShift.unit` (any, required)
    Unit of time.

  - `items.plan.invoiceTimeShift.dueTimeShift` (object)
    Calculation instruction of the invoice due time.
This is used in conjunction with the service period anchor to calculate when
an invoice is due for payment. 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).
The sequential order of due time shift is always after the due date.

  - `items.plan.invoiceTimeShift.dueTimeShift.duration` (integer, required)
    Amount of time by which to move the invoice due time or date.

  - `items.plan.invoiceTimeShift.dueTimeShift.unit` (any, required)
    Unit of time.

  - `items.plan.type` (string)
    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"

  - `items.plan.trial` (object | null, required)
    Trial configuration settings.

  - `items.quantity` (integer)
    Number of units of the product on the given plan.

  - `items.usageLimits` (any)

  - `items.usageLimits.softLimit` (object)
    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.

  - `items.usageLimits.softLimit.quantity` (integer)
    Usage limit quantity.

  - `items.usageLimits.softLimit.amount` (number)
    Usage limit amount in the currency of the order.

  - `items.usageLimits.hardLimit` (object)
    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.

  - `items.usageLimits.hardLimit.quantity` (integer)
    Usage limit quantity.

  - `items.usageLimits.hardLimit.amount` (number)
    Usage limit amount in the currency of the order.

  - `items.usageLimits.trialLimit` (any)
    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.
Once the trial limit is reached, additional usage cannot be reported unless the trial ends.
    Example: 20.725

  - `items.excludeFromMrr` (boolean | null)
    Specifies if this item is excluded from monthly recurring revenue calculations.

  - `renewalPolicy` (string)
    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`.
    Enum: "resetToRecurring", "retainRecurring", "retainTrialThenRecurring", "retainTrialOnly"

  - `prorated` (boolean)
    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.

  - `_links` (array)
    Related links.

  - `_links.href` (string)
    Link URL.

  - `_links.rel` (string)
    Type of link.
    Enum: "self"

## Response 401:

  - `401` (unknown)
    Unauthorized access.
Invalid credentials used.

## Response 401 fields (application/json):

  - `status` (integer)
    HTTP status code.

  - `type` (string)
    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".

  - `title` (string)
    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` (string)
    Human-readable explanation that is specific to this occurrence of the problem.

  - `instance` (string)
    URI reference that identifies the specific occurrence of the problem.
It may or may not yield further information if dereferenced.

## Response 403:

  - `403` (unknown)
    Access forbidden.
If the organization requires multi-factor authentication (MFA) and the session has not passed MFA, `error` is `mfa_required`.

## Response 403 fields (application/json):

  - `status` (integer)
    HTTP status code.

  - `error` (string)
    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 the request sets `requireMfa` to `true` and MFA verification has not been completed for the session, this value is `mfa_required_for_caller`.

  - `type` (string)
    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".

  - `title` (string)
    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` (string)
    Human-readable explanation that is specific to this occurrence of the problem.

  - `instance` (string)
    URI reference that identifies the specific occurrence of the problem.
It may or may not yield further information if dereferenced.

## Response 404:

  - `404` (unknown)
    Resource not found.

## Response 404 fields (application/json):

  - `status` (integer)
    HTTP status code.

  - `type` (string)
    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".

  - `title` (string)
    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` (string)
    Human-readable explanation that is specific to this occurrence of the problem.

  - `instance` (string)
    URI reference that identifies the specific occurrence of the problem.
It may or may not yield further information if dereferenced.

