Order

Version 2019-10

An order is a customer's request to purchase one or more products from a shop. You can create, retrieve, update, and delete orders using the Order resource.

Usage notes

  • When you create an order through the API, no payment information is collected, and no transaction is performed.
  • After an order is created, you can change only a few of its attributes using the API. You can't change the items or the quantities in an order using the REST API, but you can change them using the GraphQL Admin API.
  • You can add metafields to the Order resource.
  • You can allow merchants to create orders manually by using the DraftOrder resource.

Caution

You can't use the Order resource to create a new checkout for an individual store. To create a checkout, you need to use the Checkout API or an SDK powered by the Storefront API, such as the JavaScript Buy SDK, iOS Buy SDK, or Android Buy SDK.

Caution

Only the last 60 days' worth of orders from a store are accessible from the Order resource by default. If you want to access older orders, then you need to request access to all orders. If your app is granted access, then you can add the read_all_orders scope to your app along with read_orders or write_orders. Private apps are not affected by this change and are automatically granted the scope.

What you can do with Order

The Shopify API lets you do the following with the Order resource. More detailed versions of these general actions may be available:

Order properties

app_id
read-only
"app_id": 1966818

The ID of the app that created the order.

billing_address
"billing_address": {
  "address1": "2259 Park Ct",
  "address2": "Apartment 5",
  "city": "Drayton Valley",
  "company": null,
  "country": "Canada",
  "first_name": "Christopher",
  "last_name": "Gorski",
  "phone": "(555)555-5555",
  "province": "Alberta",
  "zip": "T0E 0M0",
  "name": "Christopher Gorski",
  "province_code": "AB",
  "country_code": "CA",
  "latitude": "45.41634",
  "longitude": "-75.6868"
}

The mailing address associated with the payment method. This address is an optional field that won't be available on orders that do not require a payment method. It has the following properties:

  • address1: The street address of the billing address.
  • address2: An optional additional field for the street address of the billing address.
  • city: The city, town, or village of the billing address.
  • company: The company of the person associated with the billing address.
  • country: The name of the country of the billing address.
  • country_code: The two-letter code (ISO 3166-1 format) for the country of the billing address.
  • first_name: The first name of the person associated with the payment method.
  • last_name: The last name of the person associated with the payment method.
  • latitude: The latitude of the billing address.
  • longitude: The longitude of the billing address.
  • name: The full name of the person associated with the payment method.
  • phone: The phone number at the billing address.
  • province: The name of the region (for example, province, state, or prefecture) of the billing address.
  • province_code: The two-letter abbreviation of the region of the billing address.
  • zip: The postal code (for example, zip, postcode, or Eircode) of the billing address.

browser_ip
read-only
"browser_ip": "216.191.105.146"

The IP address of the browser used by the customer when they placed the order. Both IPv4 and IPv6 are supported.

buyer_accepts_marketing
"buyer_accepts_marketing": false

Whether the customer consented to receive email updates from the shop.

cancel_reason
"cancel_reason": "customer"

The reason why the order was canceled. Valid values:

  • customer: The customer canceled the order.
  • fraud: The order was fraudulent.
  • inventory: Items in the order were not in inventory.
  • declined: The payment was declined.
  • other: A reason not in this list.

cancelled_at
read-only
"cancelled_at": null

The date and time when the order was canceled. Returns null if the order isn't canceled.

cart_token
read-only