# Create an order

Creates an order.
To create or update an order with a specified ID, use the [Upsert an order](../PutSubscription) operation.

Endpoint: POST /subscriptions
Version: latest
Security: SecretApiKey, JWT

## Security:

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

  - `JWT` (unknown)
    http bearer JWT

## Query parameters:

  - `expand` (string)
    Expand a response to receive a full related object in the `_embedded` path.

To expand multiple objects, use a comma-separated list.
Example: `expand=recentInvoice,initialInvoice`.

Available arguments are:

  - `customer`
  - `leadSource`
  - `website`
  - `shippingRate`
  - `initialInvoice`
  - `recentInvoice`
  - `upcomingInvoice`
  - `paymentInstrument`

For more information, see [Embedded resources](https://www.rebilly.com/docs/dev-docs/expand-embedded-resources).

## Request body:

  - `application/json` (unknown)
    Order resource.

## Request fields (application/json):

  - `orderType` (string, required)
    Specifies the type of order.
An order may be a subscription or a one-time purchase.
> **Note:** The order type cannot be changed after creation.
    Enum: "subscription-order"

  - `customerId` (string, required)
    ID of the customer resource.
    Example: cus_0YV7DDSDD1C8DA64KHH2W33CPF

  - `organizationId` (string)
    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).
    Example: org_0YVDM8RC7GDADADSBSMW124JA8

  - `trial` (object)
    Details of the trial.
To use plan defaults, omit the `trial` key or set this value to `null`.

  - `trial.enabled` (boolean)
    Specifies if there is a trial for this subscription.
Plans without trial prices are free trials.

  - `trial.endTime` (string | null)
    Time and date when the trial ends.
If the order churns during the trial, this value is the time when the order churned.
If a trial is enabled on this subscription, a value must be provided.

If the specified trial end time is in the past, the current time is used.

  - `isTrialOnly` (boolean)
    Specifies if a subscription ends after a trial period.
If this value is `true`, recurring settings are ignored.

  - `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.

  - `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/concepts/#service-period-anchor-and-billing-timing-and-invoice-time-shift).

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

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

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

  - `invoiceTimeShift.dueTimeShift` (object)
    Calculation instruction of the invoice due time.
This is used in conjunction with the billing 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/concepts/#service-period-anchor-and-billing-timing-and-invoice-time-shift).
The sequential order of due time shift is always after the due date.

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

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

  - `recurringInterval` (object | null)
    Recurring interval to override plan settings.
To use plan settings, set this value to `null`.
To use multiple plans in one subscription,
all plans must have the same recurring period length.
    Example: null

  - `recurringInterval.periodAnchorInstruction` (object | null)
    Instruction for calculating the service period anchor.

The service period anchor is used, in conjunction with the subscription
start time, to calculate when the service period starts and ends.

  - `recurringInterval.periodAnchorInstruction.method` (string, required)
    Enum: "day-of-month"

  - `recurringInterval.periodAnchorInstruction.day` (integer, required)
    Day of the month in which the event occurs.
If the month has less days, the last day of the month is selected.

  - `recurringInterval.periodAnchorInstruction.time` (string)
    Extended ISO-8601 format of time.

  - `recurringInterval.periodAnchorInstruction.day` (string, required)
    Day of the week when the event occurs.
    Enum: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"

  - `recurringInterval.periodAnchorInstruction.week` (string, required)
    Enum: "next", "first-in-month", "last-in-month"

  - `recurringInterval.periodAnchorInstruction.month` (integer, required)
    Month of the year in which the event occurs.

  - `autopay` (boolean)
    Specifies if payment attempts are made automatically.
If autopay is enabled, the payment is retrieved from the customer on the renewal date using the payment instrument that is set at `paymentInstrumentId`,
or the default payment instrument on the subscription.

  - `startTime` (string | null)
    Date and time when the subscription starts.
If this value is `null`, the current time is used.
This value cannot be more than one service period in the past.
    Example: null

  - `renewalTime` (string | null)
    Date and time when the subscription renews.

  - `paymentInstrumentId` (string | null)
    ID of the payment instrument to use for autopay.
If this value is not provided, or if the payment instrument is inactive,
the customer's default payment instrument is used.
    Example: inst_0YVB8KPKNXCBR9EDX7JHSED75N

  - `websiteId` (string, required)
    ID of the website.
A website is where an organization obtains a customer.
For more information, see [Obtain an organization ID and website ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
> **Note:** The ID of the website cannot be changed after creation.
    Example: web_0YV7DE4Z26DQSA1AC92FBJ7SEG

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

  - `items` (array, required)
    Details of items in the order.

  - `items.planId` (string)
    ID of the plan.
> **Note:** This field is deprecated. Use the `plan.id` field instead.
    Example: plan_0YV7DENSVGDBW9S71XZNNYYQ0X

  - `items.quantity` (integer)
    Number of product units in the specified plan.

  - `items.quantityFilled` (number)
    Number of filled product units.
    Example: 5.125

  - `items.plan` (any, required)

  - `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.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.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.
Set to `0` if no setup fee applies.

  - `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.recurringInterval` (object, required)
    Service interval settings.

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

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

  - `items.plan.recurringInterval.limit` (integer | null)
    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`.

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

  - `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.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.usageStatus` (any)

  - `items.usageStatus.isSoftLimitReached` (boolean)
    Specifies if the soft limit has been reached.
    Example: false

  - `items.usageStatus.isHardLimitReached` (boolean)
    Specifies if the hard limit has been reached.
    Example: false

  - `items.usageStatus.isTrialLimitReached` (boolean)
    Specifies if the trial limit has been reached.
    Example: false

  - `items.excludeFromMrr` (boolean)
    Specifies if this item should be excluded from monthly recurring revenue calculations.

  - `deliveryAddress` (any)
    Delivery address of the order.

  - `deliveryAddress.firstName` (string | null)
    Contact's first name.
    Example: Benjamin

  - `deliveryAddress.lastName` (string | null)
    Contact's last name.
    Example: Franklin

  - `deliveryAddress.organization` (string | null)
    Contact's organization.
    Example: Rebilly

  - `deliveryAddress.address` (string | null)
    First line of the contact's street address.
    Example: 36 Craven St

  - `deliveryAddress.address2` (string | null)
    Second line of the contact's street address.

  - `deliveryAddress.city` (string | null)
    Contact's city of residence.
    Example: Austin

  - `deliveryAddress.region` (string | null)
    Contact's region of residence.
    Example: Texas

  - `deliveryAddress.country` (string | null)
    Contact's country of residence in ISO 3166 alpha-2 country code.
For examples, see [ISO.org](https://www.iso.org/obp/ui/#search/code/).
    Example: GB

  - `deliveryAddress.postalCode` (string | null)
    Contact's postal code.
    Example: WC2N 5NF

  - `deliveryAddress.phoneNumbers` (array)
    List of phone numbers associated with the contact.

  - `deliveryAddress.phoneNumbers.label` (string, required)
    Phone number label or name.
    Example: main

  - `deliveryAddress.phoneNumbers.value` (string, required)
    Phone number value.
    Example: 1-512-777-0269

  - `deliveryAddress.phoneNumbers.primary` (boolean)
    Specifies if the phone number is the contact's primary phone number.
    Example: true

  - `deliveryAddress.emails` (array)
    List of email addresses associated with the contact.

  - `deliveryAddress.emails.label` (string, required)
    Email label or name.
    Example: main

  - `deliveryAddress.emails.value` (string, required)
    Email address value.
    Example: rebilly@example.com

  - `deliveryAddress.emails.primary` (boolean)
    Specifies if the email address is the contact's primary email address.
    Example: true

  - `deliveryAddress.dob` (string | null)
    Contact's date of birth in ISO-8601 `YYYY-MM-DD` format.
    Example: 1980-04-01

  - `deliveryAddress.jobTitle` (string | null)
    Contact's job title.
    Example: CEO

  - `billingAddress` (any)
    Billing address of the order.

  - `abandonTime` (string | null)
    Date and time when the pending order is automatically abandoned.
If this value is not passed during order creation,
a [pending order TTL](https://www.rebilly.com/catalog/all/organizations/patchorganization#organizations/patchorganization/t=request&path=settings/billing/pendingorderttl) setting is used to calculate the value.

  - `delinquencyPeriod` (string | null)
    Length of time, in ISO-8601 durations format,
which is added to the due time of the order when setting the delinquency time for all related invoices.
When the delinquency time of an invoice is reached, the order is automatically canceled.
- If the `delinquencyPeriod` value is `null`, the order does not change state and remains active.
You must explicitly configure the delinquency period to enable automatic cancellation of unpaid orders.
- If you add a delinquency period to an active order, it is applied to all new invoices created for the order. It is not applied to the unpaid and past-due invoices. To apply a delinquency period to unpaid and past-due invoices, set the `delinquencyTime` parameter using the [upsert an invoice API operation](https://www.rebilly.com/catalog/all/invoices/putinvoice#invoices/putinvoice/t=request&path=delinquencytime).

If this value is not passed during order creation,
an [order delinquency period](https://www.rebilly.com/catalog/all/organizations/patchorganization#organizations/patchorganization/t=request&path=settings/billing/orderdelinquencyperiod) setting is used to calculate the value.
    Example: P7D

  - `couponIds` (array | null)
    List of coupons to redeem on the customer and restrict to this order.
For more information, see [Coupons](https://www.rebilly.com/docs/settings/coupons-and-discounts/).
This parameter uses the following logic:
- If this parameter is not supplied, applied coupons are not changed.
- If an empty array is supplied, all applied coupon redemptions are canceled.
- If a list of coupons is supplied, unapplied coupons in the list are applied.
Coupons that have already been applied do not change state.
Applied coupons that are not supplied in list are canceled.

If the list of applied coupons on a pending order is changed by this parameter during an order update, the invoice for the order is reissued.

  - `poNumber` (string | null)
    Purchase order number displayed on the issued invoices.
    Example: PO123456

  - `shipping` (object)
    Shipping settings.

  - `shipping.amount` (number, required)
    Shipping amount.

  - `shipping.calculator` (string, required)
    Shipping calculator.
    Enum: "manual"

  - `shipping.rateId` (string | null)
    ID of the shipping rate.
If this value is not set,
the cheapest applicable shipping rate is used.
    Example: shipping-123-456

  - `notes` (string)
    Notes for the customer displayed on the order invoice.

  - `riskMetadata` (any)
    Risk metadata.
If this value is `null`, this field uses risk metadata that is captured when creating the payment token.

  - `riskMetadata.ipAddress` (string | null)
    Customer's IP address.
    Example: 93.92.91.90

  - `riskMetadata.fingerprint` (string | null)
    Customer's device fingerprint.
A device fingerprint is a unique token that is used to identify the customer.
The device fingerprint is generated based on device attributes, such as: hardware,
software, IP address, language, browser, and more.
    Example: pIUt3xbgX3l9g3YDiLbx

  - `riskMetadata.httpHeaders` (any)

  - `riskMetadata.browserData` (object | null)
    Browser data used for 3D Secure and risk scoring.

  - `riskMetadata.browserData.colorDepth` (integer, required)
    Browser color depth in bits per pixel.
This value is obtained using the `screen.colorDepth` property.
    Example: 24

  - `riskMetadata.browserData.isJavaEnabled` (boolean, required)
    Specifies if Java is enabled in a browser.
This value is obtained from the `navigator.javaEnabled` property.

  - `riskMetadata.browserData.language` (string, required)
    Browser language settings.
This value is obtained from the `navigator.language` property.
    Example: en-US

  - `riskMetadata.browserData.screenWidth` (integer, required)
    Width of the browser screen.
This value is obtained from the `screen.width` property.
    Example: 1920

  - `riskMetadata.browserData.screenHeight` (integer, required)
    Height of the browser screen.
This value is obtained from the `screen.height` property.
    Example: 1080

  - `riskMetadata.browserData.timeZoneOffset` (integer, required)
    Browser time zone offset in minutes from UTC.
A positive offset indicates that the local time is behind UTC.
A negative offset indicates that the local time is ahead of UTC.
You can find this value using the `(new Date()).getTimezoneOffset()` property.
    Example: 300

  - `riskMetadata.browserData.isAdBlockEnabled` (boolean)
    Specifies if the usage of ad block has been detected in the browser.

  - `riskMetadata.extraData` (object | null)
    Third-party data used for risk scoring.

  - `riskMetadata.extraData.kountFraudSessionId` (string)
    Alpha-numeric `fraudSessionId` as provided by the Kount SDK.
    Example: abcdefg12345abababab123456789012

  - `riskMetadata.extraData.payPalMerchantSessionId` (string)
    PayPal `MerchantSessionID` as generated by the PayPal Fraudnet SDK.
    Example: dd65ratxc5qv15iph3vyoq7l6davuowa

  - `riskMetadata.extraData.threatMetrixSessionId` (string)
    Temporary identifier that is unique to the visitor session and passed to ThreatMetrix.
    Example: dd65ratxc5qv15iph3vyoq7l6davuowadd65ratxc5qv15iph3vyoq7l6davuowa

  - `orderType` (string, required)
    Specifies the type of order.
An order may be a subscription or a one-time purchase.
    Enum: "one-time-order"

  - `websiteId` (string, required)
    ID of the website.
A website is where an organization obtains a customer.
For more information, see [Obtain an organization ID and website ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
    Example: web_0YV7DE4Z26DQSA1AC92FBJ7SEG

## Response 201:

  - `201` (unknown)
    Order created.

## Response 201 fields (application/json):

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

  - `orderType` (string, required)
    Specifies the type of order.
An order may be a subscription or a one-time purchase.
> **Note:** The order type cannot be changed after creation.
    Enum: "subscription-order"

  - `customerId` (string, required)
    ID of the customer resource.
    Example: cus_0YV7DDSDD1C8DA64KHH2W33CPF

  - `renewalReminderTime` (string | null)
    Date and time when the renewal reminder event triggers.

  - `renewalReminderNumber` (integer | null)
    Number of triggered renewal reminder events.

  - `abandonReminderTime` (string | null)
    Date and time when the abandon order reminder event triggers.

  - `abandonReminderNumber` (integer | null)
    Number of abandon order reminder events that are triggered.

  - `organizationId` (string)
    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).
    Example: org_0YVDM8RC7GDADADSBSMW124JA8

  - `status` (string)
    Status of the subscription service.
A subscription starts in the `pending` status, and becomes `active` when the service period begins.
    Enum: "pending", "active", "abandoned", "canceled", "churned", "paused", "voided", "completed", "trial-ended"

  - `inTrial` (boolean)
    Specifies if the subscription is currently in a trial period.

  - `trial` (object)
    Details of the trial.
To use plan defaults, omit the `trial` key or set this value to `null`.

  - `trial.enabled` (boolean)
    Specifies if there is a trial for this subscription.
Plans without trial prices are free trials.

  - `trial.endTime` (string | null)
    Time and date when the trial ends.
If the order churns during the trial, this value is the time when the order churned.
If a trial is enabled on this subscription, a value must be provided.

If the specified trial end time is in the past, the current time is used.

  - `isTrialOnly` (boolean)
    Specifies if a subscription ends after a trial period.
If this value is `true`, recurring settings are ignored.

  - `trialConversionTime` (string | null)
    Date and time when the subscription had a trial conversion.
Trial conversion occurs when the first successful payment is made after a trial period.

  - `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.

  - `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/concepts/#service-period-anchor-and-billing-timing-and-invoice-time-shift).

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

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

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

  - `invoiceTimeShift.dueTimeShift` (object)
    Calculation instruction of the invoice due time.
This is used in conjunction with the billing 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/concepts/#service-period-anchor-and-billing-timing-and-invoice-time-shift).
The sequential order of due time shift is always after the due date.

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

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

  - `recurringInterval` (object | null)
    Recurring interval to override plan settings.
To use plan settings, set this value to `null`.
To use multiple plans in one subscription,
all plans must have the same recurring period length.
    Example: null

  - `recurringInterval.periodAnchorInstruction` (object | null)
    Instruction for calculating the service period anchor.

The service period anchor is used, in conjunction with the subscription
start time, to calculate when the service period starts and ends.

  - `recurringInterval.periodAnchorInstruction.method` (string, required)
    Enum: "day-of-month"

  - `recurringInterval.periodAnchorInstruction.day` (integer, required)
    Day of the month in which the event occurs.
If the month has less days, the last day of the month is selected.

  - `recurringInterval.periodAnchorInstruction.time` (string)
    Extended ISO-8601 format of time.

  - `recurringInterval.periodAnchorInstruction.day` (string, required)
    Day of the week when the event occurs.
    Enum: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"

  - `recurringInterval.periodAnchorInstruction.week` (string, required)
    Enum: "next", "first-in-month", "last-in-month"

  - `recurringInterval.periodAnchorInstruction.month` (integer, required)
    Month of the year in which the event occurs.

  - `autopay` (boolean)
    Specifies if payment attempts are made automatically.
If autopay is enabled, the payment is retrieved from the customer on the renewal date using the payment instrument that is set at `paymentInstrumentId`,
or the default payment instrument on the subscription.

  - `startTime` (string | null)
    Date and time when the subscription starts.
If this value is `null`, the current time is used.
This value cannot be more than one service period in the past.
    Example: null

  - `churnTime` (string | null)
    Date and time when the subscription is deactivated.

  - `renewalTime` (string | null)
    Date and time when the subscription renews.

  - `currentPeriodStart` (string)
    Date and time of the current service period start.

  - `currentPeriodEnd` (string)
    Date and time of the current service period end.

  - `rebillNumber` (integer | null)
    Current billing period number.

  - `lineItems` (array)
    Subscription line items which queue until the next renewal, or interim, invoice is issued for the subscription.

  - `lineItems.type` (string)
    Type of invoice line item.
    Enum: "debit", "credit"

  - `lineItems.description` (string)
    Description of the line item.

  - `lineItems.unitPriceAmount` (number)
    Unit price of the line item.
    Example: 49.95

  - `lineItems.unitPriceCurrency` (string)
    Currency code in ISO 4217 format.
    Example: USD

  - `lineItems.quantity` (integer)
    Quantity of the line item.
    Example: 1

  - `lineItems.periodStartTime` (string)
    Date and time when the service period begins for this item.

  - `lineItems.periodEndTime` (string)
    Date and time when the service period ends for this item.

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

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

  - `lineItemSubtotal` (object)
    Subtotal of line items in this subscription (signed value).
If credits exceed debits, this value is a negative number.

  - `lineItemSubtotal.amount` (number)
    Amount of the subtotal.
    Example: 49.95

  - `mrr` (number)
    Monthly recurring revenue of the order.
    Example: 49.95

  - `paymentInstrumentId` (string | null)
    ID of the payment instrument to use for autopay.
If this value is not provided, or if the payment instrument is inactive,
the customer's default payment instrument is used.
    Example: inst_0YVB8KPKNXCBR9EDX7JHSED75N

  - `billingStatus` (string)
    Billing status of the most recent invoice.
This value may help you to determine if you should change the service status of the service,
such as suspending the service.
    Enum: "draft", "unpaid", "past-due", "abandoned", "paid", "voided", "refunded", "disputed", "partially-refunded", "partially-paid"

  - `websiteId` (string, required)
    ID of the website.
A website is where an organization obtains a customer.
For more information, see [Obtain an organization ID and website ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
> **Note:** The ID of the website cannot be changed after creation.
    Example: web_0YV7DE4Z26DQSA1AC92FBJ7SEG

  - `initialInvoiceId` (string | null)
    ID of the initial invoice.
    Example: in_0YVF9605RKC62BP14NE2R7V2XT

  - `recentInvoiceId` (string | null)
    ID of the most recently issued invoice.
The invoice might not be `paid` yet.
    Example: in_0YVF9605RKC62BP14NE2R7V2XT

  - `items` (array, required)
    Details of items in the order.

  - `items.id` (string)
    ID of the order item.

  - `items.planId` (string)
    ID of the plan.
> **Note:** This field is deprecated. Use the `plan.id` field instead.
    Example: plan_0YV7DENSVGDBW9S71XZNNYYQ0X

  - `items.quantity` (integer)
    Number of product units in the specified plan.

  - `items.quantityFilled` (number)
    Number of filled product units.
    Example: 5.125

  - `items.plan` (any, required)

  - `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.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.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.
Set to `0` if no setup fee applies.

  - `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._links` (array)
    Related links.

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

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

  - `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.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.usageStatus` (any)

  - `items.usageStatus.isSoftLimitReached` (boolean)
    Specifies if the soft limit has been reached.
    Example: false

  - `items.usageStatus.isHardLimitReached` (boolean)
    Specifies if the hard limit has been reached.
    Example: false

  - `items.usageStatus.isTrialLimitReached` (boolean)
    Specifies if the trial limit has been reached.
    Example: false

  - `items.revision` (integer)
    Revision number that increments with each overriding change to this specific plan item.

  - `items.isModified` (boolean)
    Specifies if the plan information is modified for this subscription.

  - `items.isGrandfathered` (boolean)
    Specifies if the current plan revision number is greater than the plan item revision number.

  - `items.excludeFromMrr` (boolean)
    Specifies if this item should be excluded from monthly recurring revenue calculations.

  - `items._embedded` (object)
    Embedded objects that are requested by the `expand` query parameter.

  - `items._embedded.product` (object)

  - `deliveryAddress` (any)
    Delivery address of the order.

  - `deliveryAddress.firstName` (string | null)
    Contact's first name.
    Example: Benjamin

  - `deliveryAddress.lastName` (string | null)
    Contact's last name.
    Example: Franklin

  - `deliveryAddress.organization` (string | null)
    Contact's organization.
    Example: Rebilly

  - `deliveryAddress.address` (string | null)
    First line of the contact's street address.
    Example: 36 Craven St

  - `deliveryAddress.address2` (string | null)
    Second line of the contact's street address.

  - `deliveryAddress.city` (string | null)
    Contact's city of residence.
    Example: Austin

  - `deliveryAddress.region` (string | null)
    Contact's region of residence.
    Example: Texas

  - `deliveryAddress.country` (string | null)
    Contact's country of residence in ISO 3166 alpha-2 country code.
For examples, see [ISO.org](https://www.iso.org/obp/ui/#search/code/).
    Example: GB

  - `deliveryAddress.postalCode` (string | null)
    Contact's postal code.
    Example: WC2N 5NF

  - `deliveryAddress.phoneNumbers` (array)
    List of phone numbers associated with the contact.

  - `deliveryAddress.phoneNumbers.label` (string, required)
    Phone number label or name.
    Example: main

  - `deliveryAddress.phoneNumbers.value` (string, required)
    Phone number value.
    Example: 1-512-777-0269

  - `deliveryAddress.phoneNumbers.primary` (boolean)
    Specifies if the phone number is the contact's primary phone number.
    Example: true

  - `deliveryAddress.emails` (array)
    List of email addresses associated with the contact.

  - `deliveryAddress.emails.label` (string, required)
    Email label or name.
    Example: main

  - `deliveryAddress.emails.value` (string, required)
    Email address value.
    Example: rebilly@example.com

  - `deliveryAddress.emails.primary` (boolean)
    Specifies if the email address is the contact's primary email address.
    Example: true

  - `deliveryAddress.dob` (string | null)
    Contact's date of birth in ISO-8601 `YYYY-MM-DD` format.
    Example: 1980-04-01

  - `deliveryAddress.jobTitle` (string | null)
    Contact's job title.
    Example: CEO

  - `deliveryAddress.hash` (string)
    Hash value for the contact.
Use this value to compare contacts for identical attribute values.
    Example: 056ae6d97c788b9e98b049ebafd7b229bf852221

  - `billingAddress` (any)
    Billing address of the order.

  - `activationTime` (string | null)
    Date and time when the order is activated.

  - `voidTime` (string | null)
    Date and time when the order is voided.

  - `abandonTime` (string | null)
    Date and time when the pending order is automatically abandoned.
If this value is not passed during order creation,
a [pending order TTL](https://www.rebilly.com/catalog/all/organizations/patchorganization#organizations/patchorganization/t=request&path=settings/billing/pendingorderttl) setting is used to calculate the value.

  - `delinquencyPeriod` (string | null)
    Length of time, in ISO-8601 durations format,
which is added to the due time of the order when setting the delinquency time for all related invoices.
When the delinquency time of an invoice is reached, the order is automatically canceled.
- If the `delinquencyPeriod` value is `null`, the order does not change state and remains active.
You must explicitly configure the delinquency period to enable automatic cancellation of unpaid orders.
- If you add a delinquency period to an active order, it is applied to all new invoices created for the order. It is not applied to the unpaid and past-due invoices. To apply a delinquency period to unpaid and past-due invoices, set the `delinquencyTime` parameter using the [upsert an invoice API operation](https://www.rebilly.com/catalog/all/invoices/putinvoice#invoices/putinvoice/t=request&path=delinquencytime).

If this value is not passed during order creation,
an [order delinquency period](https://www.rebilly.com/catalog/all/organizations/patchorganization#organizations/patchorganization/t=request&path=settings/billing/orderdelinquencyperiod) setting is used to calculate the value.
    Example: P7D

  - `poNumber` (string | null)
    Purchase order number displayed on the issued invoices.
    Example: PO123456

  - `shipping` (object)
    Shipping settings.

  - `shipping.amount` (number, required)
    Shipping amount.

  - `shipping.calculator` (string, required)
    Shipping calculator.
    Enum: "manual"

  - `shipping.rateId` (string | null)
    ID of the shipping rate.
If this value is not set,
the cheapest applicable shipping rate is used.
    Example: shipping-123-456

  - `shipping.amount` (number)
    Shipping amount which is calculated from [Shipping rates](https://www.rebilly.com/catalog/all/shipping-rates).

  - `notes` (string)
    Notes for the customer displayed on the order invoice.

  - `canceledTime` (string | null)
    Date and time when a subscription is canceled.

  - `canceledBy` (string | null)
    Specifies who initiated the cancellation.
    Enum: "merchant", "customer", "rebilly", null

  - `cancelCategory` (string | null)
    Category of the cancellation.
    Enum: "billing-failure", "delinquency", "did-not-use", "did-not-want", "missing-features", "bugs-or-problems", "do-not-remember", "risk-warning", "contract-expired", "too-expensive", "never-started", "switched-plan", "organization-deactivated", "other", null

  - `cancelDescription` (string | null)
    Description of the cancellation reason in free form.

  - `revision` (integer)
    Number of times the order data has been modified.

The revision is useful when analyzing webhook data to determine if the
change takes precedence over the current representation.

  - `riskMetadata` (any)
    Risk metadata.
If this value is `null`, this field uses risk metadata that is captured when creating the payment token.

  - `riskMetadata.ipAddress` (string | null)
    Customer's IP address.
    Example: 93.92.91.90

  - `riskMetadata.fingerprint` (string | null)
    Customer's device fingerprint.
A device fingerprint is a unique token that is used to identify the customer.
The device fingerprint is generated based on device attributes, such as: hardware,
software, IP address, language, browser, and more.
    Example: pIUt3xbgX3l9g3YDiLbx

  - `riskMetadata.httpHeaders` (any)

  - `riskMetadata.browserData` (object | null)
    Browser data used for 3D Secure and risk scoring.

  - `riskMetadata.browserData.colorDepth` (integer, required)
    Browser color depth in bits per pixel.
This value is obtained using the `screen.colorDepth` property.
    Example: 24

  - `riskMetadata.browserData.isJavaEnabled` (boolean, required)
    Specifies if Java is enabled in a browser.
This value is obtained from the `navigator.javaEnabled` property.

  - `riskMetadata.browserData.language` (string, required)
    Browser language settings.
This value is obtained from the `navigator.language` property.
    Example: en-US

  - `riskMetadata.browserData.screenWidth` (integer, required)
    Width of the browser screen.
This value is obtained from the `screen.width` property.
    Example: 1920

  - `riskMetadata.browserData.screenHeight` (integer, required)
    Height of the browser screen.
This value is obtained from the `screen.height` property.
    Example: 1080

  - `riskMetadata.browserData.timeZoneOffset` (integer, required)
    Browser time zone offset in minutes from UTC.
A positive offset indicates that the local time is behind UTC.
A negative offset indicates that the local time is ahead of UTC.
You can find this value using the `(new Date()).getTimezoneOffset()` property.
    Example: 300

  - `riskMetadata.browserData.isAdBlockEnabled` (boolean)
    Specifies if the usage of ad block has been detected in the browser.

  - `riskMetadata.extraData` (object | null)
    Third-party data used for risk scoring.

  - `riskMetadata.extraData.kountFraudSessionId` (string)
    Alpha-numeric `fraudSessionId` as provided by the Kount SDK.
    Example: abcdefg12345abababab123456789012

  - `riskMetadata.extraData.payPalMerchantSessionId` (string)
    PayPal `MerchantSessionID` as generated by the PayPal Fraudnet SDK.
    Example: dd65ratxc5qv15iph3vyoq7l6davuowa

  - `riskMetadata.extraData.threatMetrixSessionId` (string)
    Temporary identifier that is unique to the visitor session and passed to ThreatMetrix.
    Example: dd65ratxc5qv15iph3vyoq7l6davuowadd65ratxc5qv15iph3vyoq7l6davuowa

  - `riskMetadata.isProxy` (boolean)
    Specifies if the customer's IP address is related to a proxy.

  - `riskMetadata.isVpn` (boolean)
    Specifies if the customer's IP address is related to a VPN.

  - `riskMetadata.isTor` (boolean)
    Specifies if the customer's IP address is related to TOR.

  - `riskMetadata.isHosting` (boolean)
    Specifies if the customer's IP address is related to hosting.

  - `riskMetadata.hostingName` (string | null)
    Name of the data center or hosting provider, if available.

  - `riskMetadata.isp` (string | null)
    Internet Service Provider (ISP) name, if available.

  - `riskMetadata.country` (string | null)
    Country ISO Alpha-2 code of the specified IP address.
    Example: US

  - `riskMetadata.region` (string | null)
    Region of the specified IP address.
    Example: NY

  - `riskMetadata.city` (string | null)
    City of the specified IP address.
    Example: New York

  - `riskMetadata.latitude` (number)
    Latitude of the specified IP address.

  - `riskMetadata.longitude` (number | null)
    Longitude of the specified IP address.

  - `riskMetadata.postalCode` (string | null)
    Postal code of the specified IP address.

  - `riskMetadata.timeZone` (string | null)
    Time zone of the specified IP address.
    Example: America/New_York

  - `riskMetadata.accuracyRadius` (integer | null)
    Accuracy radius of the specified IP address, in kilometers.

  - `riskMetadata.distance` (integer | null)
    Distance between the customer's IP address and the billing address geolocation, in kilometers.

  - `riskMetadata.hasMismatchedBillingAddressCountry` (boolean)
    Specifies if the customer's billing address country and geo-IP address are not the same.

  - `riskMetadata.hasMismatchedBankCountry` (boolean)
    Specifies if the customer's bank country and geo-IP address are not the same.

  - `riskMetadata.hasMismatchedTimeZone` (boolean)
    Specifies if the customer's browser time zone and the IP address associated time zone are not the same.

  - `riskMetadata.hasMismatchedHolderName` (boolean)
    Specifies if the customer's billing address name and primary address name are not the same.

  - `riskMetadata.hasFakeName` (boolean)
    Specifies if the holder name seems fake.

  - `riskMetadata.isHighRiskCountry` (boolean)
    Specifies if the geo-IP country, or the customer's billing country, is considered a high risk country.

  - `riskMetadata.paymentInstrumentVelocity` (integer)
    Number of transactions for this payment instrument, based on fingerprint, in the last 24 hours.

  - `riskMetadata.declinedPaymentInstrumentVelocity` (integer)
    Number of declined transactions for this payment instrument fingerprint in the last 24 hours.

  - `riskMetadata.deviceVelocity` (integer)
    Number of transactions for this device, based on fingerprint, in the last 24 hours.

  - `riskMetadata.ipVelocity` (integer)
    Number of transactions for this IP address in the last 24 hours.

  - `riskMetadata.emailVelocity` (integer)
    Number of transactions for this email address in the last 24 hours.

  - `riskMetadata.billingAddressVelocity` (integer)
    Number of transactions for this billing address in the last 24 hours.

  - `riskMetadata.paymentInstrumentApprovedTransactionCount` (integer)
    Number of approved transactions for this payment instrument.

  - `riskMetadata.score` (integer)
    Computed risk score based on IP risk data,
such as: `isVpn`, `isTor`, and `isProxy`.

  - `billingPortalToken` (string | null)
    Customer JWT to access a billing portal.
This field is presented only if a billing portal exists.
This is an experimental field and can be changed or removed in the future.

  - `_links` (array)
    Related links.

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

  - `_links.rel` (string)
    Type of link.
    Enum: "self", "website", "customer", "initialInvoice", "recentInvoice", "approvalUrl", "attachments"

  - `_embedded` (object)
    Embedded objects that are requested by the `expand` query parameter.

  - `_embedded.recentInvoice` (object)

  - `_embedded.initialInvoice` (object)

  - `_embedded.customer` (object)

  - `_embedded.website` (object)

  - `_embedded.leadSource` (object)

  - `_embedded.shippingRate` (object)

  - `_embedded.paymentInstrument` (object)

  - `_embedded.upcomingInvoice` (object)

  - `id` (string)
    ID of the one-time sale.
    Example: ots_01HRF27SATGE4Z6PBJE6PD8328

  - `orderType` (string, required)
    Specifies the type of order.
An order may be a subscription or a one-time purchase.
    Enum: "one-time-order"

  - `status` (string)
    Status of the one-time order.
    Enum: "pending", "abandoned", "completed", "canceled"

  - `websiteId` (string, required)
    ID of the website.
A website is where an organization obtains a customer.
For more information, see [Obtain an organization ID and website ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
    Example: web_0YV7DE4Z26DQSA1AC92FBJ7SEG

  - `initialInvoiceId` (string | null)
    ID of the initial invoice (`null` for one-time orders).
    Example: in_0YVF9605RKC62BP14NE2R7V2XT

## Response 201 headers (application/json):

  - `Location` (string)
    Location of the related resource.
    Example: https://api.rebilly.com/example

  - `X-RateLimit-Limit` (integer)
    Total number of rate limit tokens for this request within a rate limit period.
For more information, see [Rate limits](#section/Rate-limits).
    Example: 3600

  - `X-RateLimit-Remaining` (integer)
    Remaining number of rate limit tokens for this request within the rate limit period. 
For example, in the sandbox environment, rate limits for non-GET endpoints are set at 3000 requests per 10 minutes.
    Example: 3600

## 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.

## Response 403 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 422:

  - `422` (unknown)
    Invalid data sent.

## Response 422 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.

  - `invalidFields` (array)
    Invalid field details.
    Example: [{"field":"field1","message":"field1 is invalid"},{"field":"subObject.field2","message":"field2 is invalid"},{"field":"subObject.field2","message":"another error in the field2"}]

  - `invalidFields.field` (string)
    Name of the field.
Dot notation is used for nested object field names.

  - `invalidFields.message` (string)
    Message field.

## Response 429:

  - `429` (unknown)
    Request rate limit exceeded.

## Response 429 fields (application/json):

  - `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".
    Example: 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.
    Example: Rate Limit Exceeded

  - `status` (integer)
    HTTP status code.

  - `detail` (string)
    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` (string)
    URI reference that identifies the specific occurrence of the problem.
It may or may not yield further information if dereferenced.

## Response 429 headers (application/json):

  - `X-RateLimit-Retry-After` (integer)
    UTC timestamp after which the rate limit resets and the request can be retried.
    Example: 1713187500

