Update an order

How to update an existing order via API

To update an existing order, send a PATCH request to the /api/orders/:id endpoint, where id is the ID of the resource that you want to update.

Here below the list of all the possible arguments that you can pass with the request body.

Request

PATCH https://yourdomain.commercelayer.io/api/orders/:id

Arguments

Body ParameterTypeRequired

type

string

Required

id

string

Required

attributes.number

string

Optional

attributes.affiliate_code

string

Optional

attributes.autorefresh

boolean

Optional

attributes.place_async

boolean

Optional

attributes.guest

boolean

Optional

attributes.customer_email

string

Optional

attributes.customer_password

string

Optional

attributes.language_code

string

Optional

attributes.freight_taxable

boolean

Optional

attributes.payment_method_taxable

boolean

Optional

attributes.adjustment_taxable

boolean

Optional

attributes.gift_card_taxable

boolean

Optional

attributes.shipping_country_code_lock

string

Optional

attributes.coupon_code

string

Optional

attributes.gift_card_code

string

Optional

attributes.cart_url

string

Optional

attributes.return_url

string

Optional

attributes.terms_url

string

Optional

attributes.privacy_url

string

Optional

attributes._archive

boolean

Optional

attributes._unarchive

boolean

Optional

attributes._pending

boolean

Optional

attributes._place

boolean

Optional

attributes._cancel

boolean

Optional

attributes._approve

boolean

Optional

attributes._approve_and_capture

boolean

Optional

attributes._authorize

boolean

Optional

attributes._authorization_amount_cents

integer

Optional

attributes._capture

boolean

Optional

attributes._refund

boolean

Optional

attributes._fulfill

boolean

Optional

attributes._update_taxes

boolean

Optional

attributes._nullify_payment_source

boolean

Optional

attributes._billing_address_clone_id

string

Optional

attributes._shipping_address_clone_id

string

Optional

attributes._customer_payment_source_id

string

Optional

attributes._shipping_address_same_as_billing

boolean

Optional

attributes._billing_address_same_as_shipping

boolean

Optional

attributes._commit_invoice

boolean

Optional

attributes._refund_invoice

boolean

Optional

attributes._save_payment_source_to_customer_wallet

boolean

Optional

attributes._save_shipping_address_to_customer_address_book

boolean

Optional

attributes._save_billing_address_to_customer_address_book

boolean

Optional

attributes._refresh

boolean

Optional

attributes._validate

boolean

Optional

attributes._create_subscriptions

boolean

Optional

attributes._start_editing

boolean

Optional

attributes._stop_editing

boolean

Optional

attributes._reset_circuit

boolean

Optional

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

relationships.market

object

Optional

relationships.customer

object

Optional

relationships.shipping_address

object

Optional

relationships.billing_address

object

Optional

relationships.store

object

Optional

relationships.payment_method

object

Optional

relationships.payment_source

object

Optional

relationships.tags

array

Optional

Example

The following request updates the order identified by the ID "xYZkjABcde":

curl -g -X PATCH \
  'https://yourdomain.commercelayer.io/api/orders/xYZkjABcde' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "orders",
    "id": "xYZkjABcde",
    "attributes": {
      "customer_email": "john@example.com"
    },
    "relationships": {
      "market": {
        "data": {
          "type": "markets",
          "id": "ABCRtyUpBa"
        }
      }
    }
  }
}'

Last updated