# Update an order

Source: https://developers.swell.is/backend-api/orders/update-an-order

Update an existing order using the ID that was returned when created. Updating performs a merge operation. To explicitly override values such as arrays, use the `$set` operator.

## Arguments

- `id` (objectId, required): Unique identifier for the order.
- `account_id` (objectId, required): ID of the customer's account.
- `account` (Account): Expandable link to the customer's account.
- `account_credit_amount` (currency): Amount of customer's account credit applied for initial payment, if applicable.
- `account_credit_applied` (boolean): Indicates the customer’s account credit is applied when submitting the order.
- `account_info_saved` (boolean): Indicates the customer chose to save shipping and billing information to their account when submitting the order.
- `account_logged_in` (boolean): Indicates the customer was logged into their account when placing the order.
- `authorized_payment` (Payment): Expandable link to an authorized payment.
- `authorized_payment_id` (string, auto): The id of an authorized payment. When "Require payment authorization" is enabled in payment settings, the order will be rejected if initial payment fails.
- `billing` (object): The customer's billing details. Defaults to `account.billing`. Updating billing will also update the corresponding account billing object.
  - `account_card_id` (objectId): ID of the customer's credit card on file, if applicable.
  - `account_card` (account_card): Expandable link to the customer's credit card on file, if applicable.
  - `address1` (string): Billing address line 1: street address/PO box/company name.
  - `address2` (string): Billing address line 2: apartment/suite/unit/building.
  - `amazon` (object): Amazon billing details used when `billing.method=amazon`.
    - `access_token` (string): Amazon access token provided when a customer authorizes payment in a storefront.
    - `order_reference_id` (string): Amazon order reference ID created when a customer initiates payment in a storefront.
    - `checkout_session_id` (string)
  - `card` (object): Credit card billing details used when `billing.method=card`.
    - `token` (string): Token generated by Swell Checkout or [Stripe.js](https://stripe.com/docs/stripe-js/reference).
    - `exp_month` (int): Two-digit number representing the credit card expiration month.
    - `exp_year` (int): Four-digit number representing the credit card expiration year.
    - `brand` (string): Credit card brand. Can be `American Express`, `Diners Club`, `Discover`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`.
    - `last4` (string): Last four digits of the card number.
    - `gateway` (string): ID of the payment gateway that should be used to process payments.
    - `test` (boolean): Indicates this is a test card.
    - `address_check` (string): When used with a payment gateway that performs address checks and `address1` was provided, can be `pass`, `fail`, `unavailable`, or `unchecked`.
    - `zip_check` (string): When used with a payment gateway that performs address checks and `zip` was provided, can be `pass`, `fail`, `unavailable`, or `unchecked`.
    - `cvc_check` (string): When used with a payment gateway that performs CVC code checks and `cvc` was provided, can be `pass`, `fail`, `unavailable`, or `unchecked`.
  - `city` (string): Billing city/district/suburb/town/village.
  - `country` (string): Two-letter ISO code country code.
  - `first_name` (string): Billing first name. If `name` is updated, then `first_name` will be automatically updated as the first word of the name.
  - `last_name` (string): Billing last name. If `name` is updated, then `last_name` will be automatically updated as the last words of the name.
  - `method` (string): Method of payment. Can be `card`, `account`, `amazon`, `paypal`, or any one of the manual methods defined in payment settings.
  - `name` (string): Billing full name. If `first_name` or `last_name` are updated, then `name` will be automatically updated as a combination of first/last.
  - `paypal` (object): PayPal billing details used when `billing.method=paypal`.
    - `payer_id` (string): PayPal payer ID provided when a customer authorizes payment in a storefront.
    - `payment_id` (string): PayPal payment ID created when a customer initiates payment in a storefront.
    - `order_id` (string)
  - `phone` (string): Billing phone number.
  - `state` (string): Billing state/county/province/region.
  - `zip` (string): Billing zip/postal code.
  - `default` (boolean): Indicates billing details represent the customer's default payment method.
  - `intent` (object): Stores the necessary information about the payment. This is typically the payment ID returned by the gateway after payment is initialized.
  - `affirm` (object): Affirm billing details used when `billing.method=affirm`.
    - `checkout_token` (string): Token used to communicate payment information to the gateway.
  - `resolve` (object): Resolve billing details used when `billing.method=resolve`.
    - `charge_id` (string): Charge ID returned by the payment gateway for the payment.
  - `ideal` (object): Ideal billing details used when `billing.method=ideal`.
    - `token` (string): Token used to communicate payment information to the gateway.
  - `google` (object): Google Pay billing details used when `billing.method=google`.
    - `nonce` (string): One-time use reference element used to communicate payment information to a payment gateway.
    - `gateway` (string): Gateway used to facilitate the transaction. For example, Braintree.
  - `apple` (object): Apple Pay billing details used when `billing.method=apple`.
    - `nonce` (string): One-time use reference element used to communicate payment information to a payment gateway.
    - `gateway` (string): Gateway used to facilitate the transaction. For example, Braintree.
  - `instructions` (string)
- `cancel_reason` (string): A message describing the reason for cancelling the order, if applicable.
- `canceled` (boolean): Indicates the order was completely canceled.
- `cart` (Cart): Expandable link to the cart.
- `cart_id` (objectId, auto): ID of the cart that converted to this order, if applicable.
- `closed` (boolean): Indicates the order is closed. Default: `false`.
- `comments` (string): Customer notes provided when placing the order, if any.
- `coupon` (Coupon): Expandable link to the coupon applied to the order.
- `coupon_code` (string): Coupon code applied to the order. See [coupons](https://developers.swell.is/backend-api/coupons) for details.
- `coupon_id` (objectId): ID of the coupon applied to the order.
- `credit_total` (currency): Total amount of additional credit applied to the order.
- `credits` (Credit memo): Expandable list of account credit transactions. Balance of these transactions is kept in `balance`.
- `currency` (string): Three-letter ISO currency code in uppercase. Defaults to the store's base currency.
- `currency_rate` (float): Currency percentage used in calculating the fixed amount.
- `date_canceled` (date): Date the order was canceled, if applicable.
- `date_payment_retry` (date): When automated payment has failed, this is the date when the system will automatically retry.
- `date_period_end` (date, auto): Period end date applicable when the order was created from a `subscription`.
- `date_period_start` (date, auto): Period start date applicable when the order was created from a `subscription`.
- `date_scheduled` (date): Scheduled date for the order.
- `date_webhook_first_failed` (date, auto): Date the order webhook first failed, if applicable. Value is unset after an order webhook is successfully returned for the record.
- `date_webhook_last_succeeded` (date): Date the order webhook last succeeded, if applicable. Value is unset after an order webhook fails to return for the record.
- `delivered` (boolean, auto): Indicates the order was completely fulfilled. Always `true` when `delivery_marked=true`, otherwise depends on the sum of `shipments`, `giftcards`, and `subscriptions`. Default: `false`.
- `delivery_marked` (boolean): Indicates the order was marked as fulfilled, manually or automatically.
- `discount_total` (currency, auto): Total discount amount.
- `discounts` (array of object): List of discounts applied to the order.
  - `id` (string): Unique identifier for the object.
  - `amount` (currency): Fixed discount amount.
  - `rule` (object): Object describing the discount rule details. Custom discounts don't require this value.
  - `type` (string): Type of discount. Can be `coupon` or `promo-<id>` referring to the source of the discount. Custom discounts don't require this value.
- `display_currency` (string): Three-letter ISO currency code representing the user's preferred display currency, if applicable.
- `display_locale` (string): Locale code representing the user's preferred display locale, if applicable.
- `draft` (boolean): Indicates that the order is a draft. Draft orders can also be designated as a cart with `draft=true` (as tracked within the Swell dashboard). [
  See the cart model](https://developers.swell.is/backend-api/carts/the-cart-model) for details.
- `gift` (boolean): Indicates the order is intended as a gift for the recipient.
- `gift_message` (string): Optional message to include with the order when shipping to the recipient.
- `giftcard_delivery` (boolean): Indicates the order has at least one line item with `delivery=giftcard`.
- `giftcard_total` (currency): Total payment amount applied to the order from `giftcards`.
- `giftcards` (array of object): List of gift cards applied to the order.
  - `amount` (currency): Amount of the gift card balance to spend on this order. Defaults to `giftcard.balance`.
  - `code` (string): Specify a gift card code to apply to the order. If the code is not found or invalid, a validation error is returned. Case-insensitive.
  - `id` (objectId): Unique identifier for the object.
  - `code_formatted` (string): Fully formatted gift card code for display purposes.
  - `last4` (string): Last four digits of the gift card code.
  - `giftcard` (giftcard): Expandable link to the gift card record.
- `grand_total` (currency, auto): Grand total including items, shipping and taxes.
- `guest` (boolean): Indicates the customer was not logged in when placing the order. Default: `{"$formula":"or(cart.guest, not(account_logged_in))"}`.
- `hold` (boolean): Indicates the order was placed on hold. Default: `false`.
- `invoices` (Invoice): Expandable link to the invoice the payment was applied to, if applicable.
- `item_discount` (currency, auto): Total discount applied to line items.
- `item_quantity` (int, auto): Total quantity of all line items.
- `item_quantity_cancelable` (int): Total quantity of cancelable items on the order.
- `item_quantity_canceled` (int, auto): Total quantity of line items canceled.
- `item_quantity_creditable` (int): Total quantity of line items that can be credited.
- `item_quantity_credited` (int): Total quantity of items credited on the order.
- `item_quantity_deliverable` (int, auto): Total quantity of line items that can be fulfilled.
- `item_quantity_delivered` (int, auto): Total quantity of line items that have been fulfilled.
- `item_quantity_giftcard_deliverable` (int, auto): Total quantity of line items that can be fulfilled by gift card. Applies when `item.delivery=giftcard`.
- `item_quantity_invoiceable` (int): Total quantity of items eligible for invoicing on the order.
- `item_quantity_invoiced` (int): Total quantity of items invoiced on the order.
- `item_quantity_returnable` (int, auto): Total quantity of line items that can still be returned.
- `item_quantity_returned` (int, auto): Total quantity of line items that have been returned.
- `item_quantity_shipment_deliverable` (int, auto): Total quantity of line items that can be fulfilled by shipment. Applies when `item.delivery=shipment`.
- `item_quantity_subscription_deliverable` (int, auto): Total quantity of line items that can be fulfilled by subscription. Applies when `item.delivery=subscription`.
- `item_shipment_weight` (float): Total shipping weight of all line items.
- `item_tax` (currency, auto): Total taxes applied to line items.
- `item_tax_included` (boolean): Indicates line item prices include taxes.
- `items` (array of object): List of line items describing the products ordered.
  - `bundle_items` (array of object): List of items offered as a bundle. Defaults to `product.bundle_items`.
    - `product_id` (objectId, required): ID of the bundle item product.
    - `product` (product): Expandable link to the bundle item product.
    - `quantity` (int): Quantity of the bundle item being ordered. Defaults to 1. Default: `1`.
    - `shipment_weight` (float): Weight to be used in shipping calculation, if applicable.
    - `quantity_restocked` (int): Quantity of the bundle item that has been restocked after a return, if applicable.
    - `quantity_returnable` (int): Quantity of the bundle item that can still be returned after fulfillment, if applicable.
    - `variant_id` (objectId): ID of the bundle item variant.
    - `variant` (variant): Expandable link to the bundle item product variant.
    - `id` (objectId, auto): Unique identifier for the object.
    - `delivery` (enum): Method of delivery taken automatically from `product.delivery`. Possible values: `shipment`, `giftcard`, `subscription`.
    - `options` (array of object): Item options matching one or more of `product.options`. When adding to the order, you can specify either the option `id` or `name` (case-insensitive) to identify the option.

      Gift card products have two special options that can be used when fulfilling gift cards by email. Use the option ID `send_email` and value as the recipient email address, and `send_note` as a custom message from the customer to the recipient sent by email.
      - `id` (string): Unique identifier for the object.
      - `name` (string): Name of the product option. Populated automatically when adding an option by ID.
      - `price` (currency): Additional price added onto the base price of the product.
      - `shipment_weight` (float): Additional shipping weight added onto the base weight of the product.
      - `value` (string): Name value of the product option. When adding to the order, specify either the product option value `id` or `name` (case-insensitive) to identify the value.
      - `variant` (boolean): Indicates the option refers to a variant aspect.
      - `value_id` (objectId)
    - `quantity_canceled` (int): Quantity of the bundle item canceled before fulfillment, if applicable. Default: `0`.
    - `quantity_consumed` (int): Quantity of stock consumed by the bundle item, if applicable.
    - `quantity_deliverable` (int): Quantity of the bundle item that can be fulfilled, if applicable.
    - `quantity_delivered` (int): Quantity of the bundle item that has been fulfilled, if applicable. Default: `0`.
    - `quantity_giftcard_deliverable` (int): Quantity of the bundle item that can be fulfilled by a gift card. Applies when `delivery=giftcard`.
    - `quantity_returned` (int): Total quantity of bundle items that have been returned.
    - `quantity_shipment_deliverable` (int): Quantity of the bundle item that can be fulfilled by a shipment. Applies when `delivery=shipment`.
    - `quantity_total` (int): Total quantity of the bundle item to be fulfilled, calculated as `item.quantity * bundle_item.quantity`.
    - `stock_tracking` (boolean): Indicates whether the bundle item has stock tracking enabled.
    - `quantity_shipment_delivered` (int): Quantity of shipments that have been delivered.
    - `product_name` (string): This field is a copy of the item's `product.name`. Default: `{"$formula":"if(product_id, product.name, null)"}`.
  - `description` (string): Description used for custom line items, when product is not defined.
  - `discounts` (array of object): List of discounts to apply to the item. Normally populated by applying a [coupon](https://developers.swell.is/backend-api/coupons/the-coupon-model) or [promotions.](https://developers.swell.is/backend-api/promotions/the-promotion-model)
    - `id` (string, required): Unique identifier for the object. Should refer to one of the IDs in the order `discounts` object.
    - `amount` (currency, required): Fixed discount amount.
  - `metadata` (object): Arbitrary item data, typically set in a checkout flow to store custom values. See [Storefront API](https://developers.swell.is/frontend-api/introduction) for details.
  - `options` (array of object): Item options matching one or more of `product.options`. When adding to the order, you can specify either the option `id` or `name` (case-insensitive) to identify the option.

    Gift card products have two special options that can be used when fulfilling gift cards by email. Use the option ID `send_email` and value as the recipient email address, and `send_note` as a custom message from the customer to the recipient sent by email.
    - `id` (string): Unique identifier for the object.
    - `name` (string): Name of the product option. Populated automatically when adding an option by ID.
    - `price` (currency): Additional price added onto the base price of the product.
    - `shipment_weight` (float): Additional shipping weight added onto the base weight of the product.
    - `variant` (boolean): Indicates the option refers to a variant aspect.
    - `value` (string): Name value of the product option. When adding to the order, specify either the product option value `id` or `name` (case-insensitive) to identify the value.
    - `value_id` (objectId): ID associate to the value.
  - `price` (currency): Price of the item. Override this value to set a custom price. Defaults to product price or sale price. Default: `{"$formula":"if(product_id, product.price)"}`.
  - `product_id` (objectId): ID of the item product.
  - `quantity` (int): Quantity of the item being ordered. Defaults to 1. Default: `1`.
  - `quantity_restocked` (int): Quantity of the item that has been restocked after a return, if applicable.
  - `quantity_returnable` (int): Quantity of the item that can still be returned after fulfillment, if applicable.
  - `quantity_returned` (int): Quantity of the item that has been returned after fulfillment, if applicable.
  - `shipment_weight` (float): Weight to be used in shipping calculation, if applicable.
  - `taxes` (array of object): List of tax rules to apply to the item. Normally populated by tax settings.
    - `id` (string, required): Unique identifier for the object. Should refer to one of the IDs in the order `taxes` object.
    - `amount` (currency, required): Fixed tax amount.
  - `variant_id` (objectId): ID of the item variant, if applicable.
  - `id` (objectId, auto): Unique identifier for the item.
  - `delivery` (enum): Method of delivery taken automatically from `product.delivery`. Possible values: `shipment`, `giftcard`, `subscription`.
  - `discount_each` (currency): Total discount amount divided by quantity.
  - `discount_total` (currency): Total discount applied to the item.
  - `orig_price` (currency): Original item price used internally to determine if the item price was overridden and should be automatically updated when item options are changed.
  - `price_total` (currency): Total price added to sub total by multiplying `quantity` and `price`.
  - `product` (product): Expandable link to the item product.
  - `product_name` (string): Name of the product. Default: `{"$formula":"if(product_id, product.name, null)"}`.
  - `quantity_canceled` (int): Quantity of the item canceled before fulfillment, if applicable. Default: `0`.
  - `quantity_consumed` (int): Quantity of stock consumed by the item, if applicable.
  - `quantity_deliverable` (int): Quantity of the item that can be fulfilled, if applicable.
  - `quantity_delivered` (int): Quantity of the item that has been fulfilled, if applicable. Default: `0`.
  - `quantity_giftcard_deliverable` (int): Quantity of the item that can be fulfilled by a gift card. Applies when `delivery=giftcard`.
  - `quantity_shipment_deliverable` (int): Quantity of the item that can be fulfilled by a shipment. Applies when `delivery=shipment`.
  - `quantity_subscription_deliverable` (int): Quantity of the item that can be fulfilled by a subscription. Applies when `delivery=subscription`.
  - `shipment_location` (string): ID of location from `/settings/shipping/locations`. If specified, shipping is calculated from this location. Otherwise, the store's default location will be used.
  - `stock_tracking` (boolean): Indicates whether the item has stock tracking enabled.
  - `subscription_paid` (boolean): Indicates the item has been fulfilled as a [subscription](https://developers.swell.is/backend-api/subscriptions/the-subscription-model) and marked as `paid by reference to this order.`
  - `tax_each` (currency): Total tax amount divided by quantity.
  - `tax_total` (currency): Total tax applied to the item.
  - `variant` (variant): Expandable link to the item variant, if applicable.
- `metadata` (object): Arbitrary data, typically set in a checkout flow to store custom values. See [Storefront API](https://developers.swell.is/frontend-api/introduction) for details.
- `next` (Order): If `next_id` is set by the customer, `next` will link to the order with the given `next_id`.
- `next_id` (objectId): This never gets set by Swell. A customer must explicitly set this field to a particular order ID.
- `notes` (string): Internal admin notes, not visible to the customer.
- `notifications` (Notification): Expandable list of notifications sent on behalf of the order.
- `number` (string, auto): Unique incremental order number, assigned automatically using a format configured in general settings.
- `paid` (boolean, auto): Indicates the order was paid in full. Always `true` when `payment_marked=true`, otherwise depends on the sum of `payments`. Default: `false`.
- `parent` (Order): Expandable link to the parent order.
- `parent_id` (objectId): ID of the parent order.
- `payment_balance` (currency, auto): Balance of payments. A negative number indicates payment is owed, a positive balance indicates a refund is due, and a zero balance indicates fully paid.
- `payment_error` (string): A message describing the last payment error, if one occurred.
- `payment_marked` (boolean): Indicates the order was marked as paid, manually or automatically.
- `payment_retry_count` (int): The number of times automatic payment has been attempted.
- `payment_retry_resolve` (string): The method used to resolve automatic payment when all retry attempts are exhausted. Can be blank (do nothing), `canceled`, or `unpaid`.
- `payment_total` (currency): Sum of payments applied to the order, not including refunds. Default: `0`.
- `payments` (Payment): Expandable list of payments applied to the order.
- `pending_invoices` (Invoice): Expandable list of invoices that haven't been fully paid.
- `prev` (Order): If `prev_id` is set by the customer, `prev` will link to the order with the given `prev_id`.
- `prev_id` (objectId): This never gets set by Swell. A customer must explicitly set this field to a particular order ID.
- `promotion_ids` (array of child_scalar): List of promotion IDs applied to the order.
- `promotions` (Promotion): Expandable list of promotions applied to the order.
- `refund_marked` (boolean): Set `true` mark the order as fully refunded, regardless of refund records.
- `refund_total` (currency): Sum of refunds on payments applied to the order. Default: `0`.
- `refunded` (boolean, auto): Indicates the order was fully refunded. Always `true` when `refund_marked=true`, otherwise depends on the sum of `refunds`. Default: `false`.
- `refunds` (Refund): Expandable list of refunds applied to the order.
- `return_credit_tax` (currency): Total additional credit tax applied to the order from returns, if applicable
- `return_credit_total` (currency): Total additional credit amount applied to the order from returns.
- `return_item_tax` (currency, auto): Total tax amount of items returned.
- `return_item_tax_included` (currency, auto): Total tax included amount of items returned, separate from line item values.
- `return_item_total` (currency, auto): Total amount of items returned, minus discounts.
- `return_total` (currency): Grand total amount applied to the order from returns.
- `shipment_delivery` (boolean): Indicates the order has at least one line item with `delivery=shipment`.
- `shipment_discount` (currency): Shipping discount applied by [coupons](https://developers.swell.is/backend-api/coupons), [promotions](https://developers.swell.is/backend-api/promotions), or custom logic.
- `shipment_price` (currency, auto): Total shipping price before discounts.
- `shipment_rating` (object, auto): Object describing the shipping services and rates available for the order. Shipping `country` must be set before retrieving shipping rates.
  - `errors` (array of object): List of errors generated while retrieving rates, if any. When using third-party shipping services, any system errors will be listed here.
    - `code` (string): Unique code describing the error.
    - `message` (string): Message describing the error.
  - `fingerprint` (string): Unique fingerprint identifying the parameters used to calculate shipping rates. Rates should always be the same given the same parameters and shipping settings.
  - `services` (array of object): List of shipping services and rates available.
    - `id` (string): Unique identifier for the object.
    - `carrier` (string): Name of a third-party carrier offering the service, if applicable.
    - `name` (string): Name of the shipping service.
    - `price` (currency): Price of the shipping service.
    - `pickup` (boolean): Indicates whether shipping service is local pick-up.
- `shipment_tax` (currency): Shipping tax amount, if applicable.
- `shipment_tax_included` (boolean): Indicates shipping total includes taxes, if applicable.
- `shipment_tax_included_total` (currency, auto): Total shipping price including taxes and discount. Allows for an alternate display style as normally `shipment_total` and `tax_total` are shown separately.
- `shipment_total` (currency, auto): Total shipping price after discounts.
- `shipment_total_credited` (currency): Total shipping price for items credited on the order.
- `shipments` (Shipment): Expandable list of shipments created from the order.
- `shipping` (object): The customer's shipping details. Defaults to `account.shipping`. Updating shipping will also update the corresponding account shipping object.
  - `account_address_id` (objectId): ID of the customer's address on file.
  - `account_address` (account_address): Expandable link to the customer's address on file.
  - `address1` (string): Shipping address line 1: street address/PO box/company name.
  - `address2` (string): Shipping address line 2: apartment/suite/unit/building.
  - `city` (string): Shipping city/district/suburb/town/village.
  - `country` (string): Two-letter ISO country code.
  - `default` (boolean): Indicates shipping details represent the customer's default shipping address.
  - `first_name` (string): Shipping first name. If `name` is updated, then `first_name` will be automatically updated as the first word of the name.
  - `last_name` (string): Shipping last name. If `name` is updated, then `last_name` will be automatically updated as the last words of the name.
  - `name` (string): Shipping full name. If `first_name` or `last_name` are updated, then `name` will be automatically updated as a combination of first/last.
  - `phone` (string): Shipping phone number.
  - `price` (currency): Price of the shipping service. Defaults to `shipment_rating.services.price` chosen by setting `service`.
  - `service` (string): ID of a shipping service as configured in shipment settings. Normally, this would be applied after [retrieving shipping rates](https://developers.swell.is/backend-api/shipments/retrieve-a-shipment) by using one of the `shipment_rating.services.id` values.
  - `service_name` (string): Name of the shipping service. Defaults to `shipment_rating.services.name` chosen by setting `service`.
  - `state` (string): Shipping state/county/province/region.
  - `zip` (string): Shipping zip/postal code.
  - `pickup` (boolean): Indicates whether shipping for local pick-up.
- `status` (enum, auto): Current status of the order. Can be `pending`, `draft`, `payment_pending`, `delivery_pending`, `hold`, `complete`, or `canceled`. Possible values: `pending`, `draft`, `payment_pending`, `delivery_pending`, `hold`, `complete`, `canceled`. Default: `"pending"`.
- `sub_total` (currency, auto): Sum of all line items before discounts, taxes and shipping.
- `subscription` (Subscription): Expandable link to the subscription that spawned the order, if applicable.
- `subscription_delivery` (boolean): Indicates the order has at least one line item with `delivery=subscription`.
- `subscription_id` (objectId, auto): ID of the subscription that spawned the order, if applicable.
- `tax_included_total` (currency, auto): Total of taxes applied separately from line items.
- `tax_total` (currency, auto): Total tax amount applied to the order including line items and shipping.
- `taxes` (array of object): List of taxes applied to the order.
  - `id` (string): Unique identifier for the object.
  - `amount` (currency): Fixed tax amount.
  - `name` (string): Name of the tax rule. For example, "NY Sales Tax".
  - `priority` (int): Priority indicates the order in which a tax rule was applied. Higher priority rules are added on top of other tax rules with a lower priority. Rules with the same priority are calculated excluding each other.
  - `rate` (float): Tax percentage used in calculating the fixed amount.
  - `shipping` (boolean): Indicates the tax applies to shipping.
- `taxes_fixed` (boolean): Indicates the order is tax-exempt. Taxes will not be calculated or applied when true.
- `test` (boolean): Indicates the order was made in test mode.
- `webhook_attempts_failed` (int, auto): Number of failed order webhook attempts, if applicable. Value is unset after an order webhook is successfully returned for the record.
- `webhook_response` (string, auto): Text response of the last failed order webhook attempt, if applicable. Value is unset after an order webhook is successfully returned for the record.
- `webhook_status` (int, auto): HTTP response status of the last failed order webhook attempt, if applicable. Value is unset after an order webhook is successfully returned for the record.

## Example request

`PUT /orders/:id`

**cURL**

```bash
$ curl https://api.swell.store/orders/5cad15bc9b14d1990724663a \
  -u store-id:secret-key \
  -d name="Jon Snow" \
  -d address1="1 Main Street" \
  -d city=Brooklyn \
  -d state=NY \
  -d zip=11201 \
  -d country=US \
  -d phone="(555) 555-5555" \
  -X PUT
```

**Node**

```javascript
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');

await swell.put('/orders/{id}', {
  id: '5cad15bc9b14d1990724663a',
  shipping: {
    name: 'Jon Snow',
    address1: '1 Main Street',
    city: 'Brooklyn',
    state: 'NY',
    zip: '11201',
    country: 'US',
    phone: '(555) 555-5555',
  },
});
```

**PHP**

```php
<?php $swell = new \Swell\Client('store-id', 'secret-key');

$swell->put('/orders/{id}', [
  'id' => '5cad15bc9b14d1990724663a',
  'shipping' => [
    'name' => 'Jon Snow',
    'address1' => '1 Main Street',
    'city' => 'Brooklyn',
    'state' => 'NY',
    'zip' => '11201',
    'country' => 'US',
    'phone' => '(555) 555-5555'
  ]
]);
```

## Example response

```json
{
  "id": "5cad15bc9b14d1990724663a",
  "account_id": "5a9ea7ba3f95740a914267f1",
  "billing": {...},
  "shipping": {
    "name": "Jon Snow",
    "first_name": "Jon",
    "last_name": "Snow",
    "address1": "1 Main Street",
    "city": "Brooklyn",
    "state": "NY",
    "zip": "11201",
    "country": "US",
    "phone": "(555) 555-5555"
  },
  "items": [
    {
      "id": "5a9ea7ba3f95740a914267f2",
      "product_id": "5cad15bc9b14d1990724663b",
      "quantity": 2,
      "price": 9.99,
      "price_total": 18.98,
      "shipment_weight": 1.5,
      ...
    }
  ],
  "coupon_code": "FREESHIPPING",
  "currency": "USD",
  "date_created": "2019-04-01T00:00:00.000Z",
  "date_updated": "2019-04-01T00:00:00.000Z",
  "delivered": false,
  "discount_total": 0,
  "grand_total": 18.98,
  "item_quantity": 2,
  "item_shipment_weight": 3.0,
  "item_tax": 0,
  "number": "100101",
  "paid": false,
  "payment_balance": -18.98,
  "payment_total": 0,
  "refund_total": 0,
  "refunded": false,
  "shipment_price": 0,
  "shipment_total": 0,
  "status": "payment_pending",
  "sub_total": 0,
  "tax_total": 0,
  ...
}
```
