Adding orders

There are three ways to create orders to your sales channel.

Using the Checkout API

Using the Checkout API, your app can programmatically create a Shopify cart, reserve inventory, retrieve shipping rates, calculate taxes and process payments for a Shopify merchant. This API helps your channel respect the merchant's business settings and make it easy for new merchants to start selling through your app.

The Checkout API is only for use with the Sales Channel SDK. It is not possible to use it to create a new checkout for an individual shop, but you can use our JavaScript, iOS, and Android Buy SDKs instead for this purpose.

Learn more about the Checkout API.

All Shopify stores come with a beautiful, responsive web checkout. Cart permalinks allow you to link to a pre-filled web checkout containing product variants of your choosing. You can make sure that the resulting checkout will be attributed to your application by adding the api_key URL parameter to the cart permalink.

https://your-store.myshopify.com/cart/70881412:1,70881382:1?api_key=b8aa30d8f1d398883f0eeb5079777c41

You can pass other marketing attribution data to Shopify using utm URL parameters. Learn more.

Using your own checkout and the Orders API

Note

If you are building a sales channel and you would like to use the Orders API then you must reach out to the sales channel team for approval.

Using the Checkout API is the best way for your sales new channel to process sales. In special cases, sales channels may need to process orders using an external checkout system due to the dynamics of the checkout process. If your sales channel cannot use the Checkout API then you can import orders to Shopify using our Orders API.

Sample request to create an order with the Orders API:

POST /admin/orders.json HTTP/1.1
Host: channelsrule.myshopify.com
X-Shopify-Access-Token: 085abas8bd90325c3f81s8e9c88befc0
Content-Type: application/json

{
  "order": {
    "email": "josh@shopify.com",
    "fulfillment_status": "fulfilled",
    "line_items": [
      {
        "variant_id": 5544733572,
        "quantity": 1
      }
    ],
    "transactions": [
      {
        "kind": "sale",
        "status": "success",
        "amount": 298.99
      }
    ]
  }
}

View Response

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8

{
    "order": {
        "id": 2072637764,
        "email": "josh@shopify.com",
        "closed_at": null,
        "attributed_application_id": 2329148,
        "created_at": "2015-12-07T22:25:29+01:00",
        "updated_at": "2015-12-07T22:25:29+01:00",
        "number": 137,
        "note": null,
        "token": "01865d0fc75c61164d9edcfdc1c3d7d3",
        "gateway": "",
        "test": false,
        "total_price": "298.99",
        "subtotal_price": "298.99",
        "total_weight": 0,
        "total_tax": "0.00",
        "taxes_included": false,
        "currency": "USD",
        "financial_status": "paid",
        "confirmed": true,
        "total_discounts": "0.00",
        "total_line_items_price": "298.99",
        "cart_token": null,
        "buyer_accepts_marketing": false,
        "name": "#1137",
        "referring_site": null,
        "landing_site": null,
        "cancelled_at": null,
        "cancel_reason": null,
        "total_price_usd": "298.99",
        "checkout_token": null,
        "reference": null,
        "user_id": null,
        "location_id": null,
        "source_identifier": null,
        "source_url": null,
        "processed_at": "2015-12-07T22:25:29+01:00",
        "device_id": null,
        "browser_ip": null,
        "landing_site_ref": null,
        "order_number": 1137,
        "discount_codes": [],
        "note_attributes": [],
        "payment_gateway_names": [
            ""
        ],
        "processing_method": "",
        "checkout_id": null,
        "source_name": "1206888",
        "fulfillment_status": "fulfilled",
        "tax_lines": [],
        "tags": "",
        "contact_email": "josh@shopify.com",
        "line_items": [
            {
                "id": 3777619140,
                "variant_id": 5544733572,
                "title": "Dynamic Querky Cool",
                "quantity": 1,
                "price": "298.99",
                "grams": 0,
                "sku": "",
                "variant_title": "Blue",
                "vendor": null,
                "fulfillment_service": "manual",
                "product_id": 1565559748,
                "requires_shipping": true,
                "taxable": true,
                "gift_card": false,
                "name": "Dynamic Querky Cool - Blue",
                "variant_inventory_management": null,
                "properties": [],
                "product_exists": true,
                "fulfillable_quantity": 0,
                "total_discount": "0.00",
                "fulfillment_status": "fulfilled",
                "tax_lines": []
            }
        ],
        "shipping_lines": [],
        "fulfillments": [
            {
                "id": 1784424068,
                "order_id": 2072637764,
                "status": "success",
                "created_at": "2015-12-07T22:25:29+01:00",
                "service": "manual",
                "updated_at": "2015-12-07T22:25:29+01:00",
                "tracking_company": null,
                "tracking_number": null,
                "tracking_numbers": [],
                "tracking_url": null,
                "tracking_urls": [],
                "receipt": {},
                "line_items": [
                    {
                        "id": 3777619140,
                        "variant_id": 5544733572,
                        "title": "Dynamic Querky Cool",
                        "quantity": 1,
                        "price": "298.99",
                        "grams": 0,
                        "sku": "",
                        "variant_title": "Blue",
                        "vendor": null,
                        "fulfillment_service": "manual",
                        "product_id": 1565559748,
                        "requires_shipping": true,
                        "taxable": true,
                        "gift_card": false,
                        "name": "Dynamic Querky Cool - Blue",
                        "variant_inventory_management": null,
                        "properties": [],
                        "product_exists": true,
                        "fulfillable_quantity": 0,
                        "total_discount": "0.00",
                        "fulfillment_status": "fulfilled",
                        "tax_lines": []
                    }
                ]
            }
        ],
        "refunds": [],
        "customer": {
            "id": 2131047812,
            "email": "josh@shopify.com",
            "accepts_marketing": false,
            "created_at": "2015-12-07T22:25:29+01:00",
            "updated_at": "2015-12-07T22:25:29+01:00",
            "first_name": null,
            "last_name": null,
            "orders_count": 1,
            "state": "disabled",
            "total_spent": "50.00",
            "last_order_id": 2072637764,
            "note": null,
            "verified_email": true,
            "multipass_identifier": null,
            "tax_exempt": false,
            "tags": "",
            "last_order_name": "#1137"
        }
    }
}