WooCommerce REST API 文档

title: "订单 #" post_status: publish comment_status: open taxonomy: category: - woocommerce-rest-api post_tag: - Wp Api V1 - Includes - Source


订单

订单 API 允许您创建、查看、更新和删除单个或批量订单。

订单属性

Attribute Type Description
id integer Unique identifier for the resource. read-only
parent_id integer Parent order ID.
status string Order status. Default is pending. Options (plugins may include new status): pending, processing, on-hold, completed, cancelled, refunded and failed.
order_key string Order key. read-only
number string Order number. read-only
currency string Currency the order was created with, in ISO format, e.g USD. Default is the current store currency.
version string Version of WooCommerce when the order was made. read-only
prices_include_tax boolean Shows if the prices included tax during checkout. read-only
date_created date-time The date the order was created, in the site's timezone. read-only
date_modified date-time The date the order was last modified, in the site's timezone. read-only
customer_id integer User ID who owns the order. Use 0 for guests. Default is 0.
discount_total string Total discount amount for the order. read-only
discount_tax string Total discount tax amount for the order. read-only
shipping_total string Total shipping amount for the order. read-only
shipping_tax string Total shipping tax amount for the order. read-only
cart_tax string Sum of line item taxes only. read-only
total string Grand total. read-only
total_tax string Sum of all taxes. read-only
billing object Billing address. See Customer Billing Address properties.
shipping object Shipping address. See Customer Shipping Address properties.
payment_method string Payment method ID.
payment_method_title string Payment method title.
set_paid boolean Define if the order is paid. It will set the status to processing and reduce stock items. Default is false. write-only
transaction_id string Unique transaction ID. In write-mode only is available if set_paid is true.
customer_ip_address string Customer's IP address. read-only
customer_user_agent string User agent of the customer. read-only
created_via string Shows where the order was created. read-only
customer_note string Note left by customer during checkout.
date_completed date-time The date the order was completed, in the site's timezone. read-only
date_paid date-time The date the order has been paid, in the site's timezone. read-only
cart_hash string MD5 hash of cart items to ensure orders are not modified. read-only
line_items array Line items data. See Line Items properties.
tax_lines array Tax lines data. See Tax Lines properties. read-only
shipping_lines array Shipping lines data. See Shipping Lines properties.
fee_lines array Fee lines data. See Fee Lines Properties.
coupon_lines array Coupons line data. See Coupon Lines properties.
refunds array List of refunds. See Refunds Lines properties. read-only

Line item properties

Attribute Type Description
id integer Item ID. read-only
name string Product name. read-only
sku string Product SKU. read-only
product_id integer Product ID.
variation_id integer Variation ID, if applicable.
quantity integer Quantity ordered.
tax_class string Tax class of product. read-only
price string Product price. read-only
subtotal string Line subtotal (before discounts).
subtotal_tax string Line subtotal tax (before discounts).
total string Line total (after discounts).
total_tax string Line total tax (after discounts).
taxes array Line taxes with id, total and subtotal. read-only
meta array Line item meta data with key, label and value. read-only

Tax line properties

Attribute Type Description
id integer Item ID. read-only
rate_code string Tax rate code. read-only
rate_id string Tax rate ID. read-only
label string Tax rate label. read-only
compound boolean Show if is a compound tax rate. Compound tax rates are applied on top of other tax rates. read-only
tax_total string Tax total (not including shipping taxes). read-only
shipping_tax_total string Shipping tax total. read-only

Shipping line properties

Attribute Type Description
id integer Item ID. read-only
method_title string Shipping method name.
method_id string Shipping method ID. required
total string Line total (after discounts).
total_tax string Line total tax (after discounts). read-only
taxes array Line taxes with id and total. read-only

Fee line properties

Attribute Type Description
id integer Item ID. read-only
name string Fee name. required
tax_class string Tax class. required if the fee is taxable
tax_status string Tax status of fee. Set to taxable if need apply taxes.
total string Line total (after discounts).
total_tax string Line total tax (after discounts).
taxes array Line taxes with id, total and subtotal. read-only

Coupon line properties

Attribute Type Description
id integer Item ID. read-only
code string Coupon code. required
discount string Discount total. required
discount_tax string Discount total tax. read-only

Refund line properties

Attribute Type Description
id integer Refund ID. read-only
reason string Refund reason. read-only
total string Refund total. read-only

创建订单

此 API 可帮助您创建新订单。

HTTP 请求

POST
/wp-json/wc/v1/orders

创建已支付订单的示例:

curl -X POST https://example.com/wp-json/wc/v1/orders \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "payment_method": "bacs",
  "payment_method_title": "Direct Bank Transfer",
  "set_paid": true,
  "billing": {
    "first_name": "John",
    "last_name": "Doe",
    "address_1": "969 Market",
    "address_2": "",
    "city": "San Francisco",
    "state": "CA",
    "postcode": "94103",
    "country": "US",
    "email": "john.doe@example.com",
    "phone": "(555) 555-5555"
  },
  "shipping": {
    "first_name": "John",
    "last_name": "Doe",
    "address_1": "969 Market",
    "address_2": "",
    "city": "San Francisco",
    "state": "CA",
    "postcode": "94103",
    "country": "US"
  },
  "line_items": [
    {
      "product_id": 93,
      "quantity": 2
    },
    {
      "product_id": 22,
      "variation_id": 23,
      "quantity": 1
    }
  ],
  "shipping_lines": [
    {
      "method_id": "flat_rate",
      "method_title": "Flat Rate",
      "total": "10.00"
    }
  ]
}'
const data = {
  payment_method: "bacs",
  payment_method_title: "Direct Bank Transfer",
  set_paid: true,
  billing: {
    first_name: "John",
    last_name: "Doe",
    address_1: "969 Market",
    address_2: "",
    city: "San Francisco",
    state: "CA",
    postcode: "94103",
    country: "US",
    email: "john.doe@example.com",
    phone: "(555) 555-5555"
  },
  shipping: {
    first_name: "John",
    last_name: "Doe",
    address_1: "969 Market",
    address_2: "",
    city: "San Francisco",
    state: "CA",
    postcode: "94103",
    country: "US"
  },
  line_items: [
    {
      product_id: 93,
      quantity: 2
    },
    {
      product_id: 22,
      variation_id: 23,
      quantity: 1
    }
  ],
  shipping_lines: [
    {
      method_id: "flat_rate",
      method_title: "Flat Rate",
      total: "10.00"
    }
  ]
};

WooCommerce.post("orders", data)
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.log(error.response.data);
  });
<?php
$data = [
    'payment_method' => 'bacs',
    'payment_method_title' => 'Direct Bank Transfer',
    'set_paid' => true,
    'billing' => [
        'first_name' => 'John',
        'last_name' => 'Doe',
        'address_1' => '969 Market',
        'address_2' => '',
        'city' => 'San Francisco',
        'state' => 'CA',
        'postcode' => '94103',
        'country' => 'US',
        'email' => 'john.doe@example.com',
        'phone' => '(555) 555-5555'
    ],
    'shipping' => [
        'first_name' => 'John',
        'last_name' => 'Doe',
        'address_1' => '969 Market',
        'address_2' => '',
        'city' => 'San Francisco',
        'state' => 'CA',
        'postcode' => '94103',
        'country' => 'US'
    ],
    'line_items' => [
        [
            'product_id' => 93,
            'quantity' => 2
        ],
        [
            'product_id' => 22,
            'variation_id' => 23,
            'quantity' => 1
        ]
    ],
    'shipping_lines' => [
        [
            'method_id' => 'flat_rate',
            'method_title' => 'Flat Rate',
            'total' => '10.00'
        ]
    ]
];

print_r($woocommerce->post('orders', $data));
?>
data = {
    "payment_method": "bacs",
    "payment_method_title": "Direct Bank Transfer",
    "set_paid": True,
    "billing": {
        "first_name": "John",
        "last_name": "Doe",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US",
        "email": "john.doe@example.com",
        "phone": "(555) 555-5555"
    },
    "shipping": {
        "first_name": "John",
        "last_name": "Doe",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
    },
    "line_items": [
        {
            "product_id": 93,
            "quantity": 2
        },
        {
            "product_id": 22,
            "variation_id": 23,
            "quantity": 1
        }
    ],
    "shipping_lines": [
        {
            "method_id": "flat_rate",
            "method_title": "Flat Rate",
            "total": "10.00"
        }
    ]
}

print(wcapi.post("orders", data).json())
data = {
  payment_method: "bacs",
  payment_method_title: "Direct Bank Transfer",
  set_paid: true,
  billing: {
    first_name: "John",
    last_name: "Doe",
    address_1: "969 Market",
    address_2: "",
    city: "San Francisco",
    state: "CA",
    postcode: "94103",
    country: "US",
    email: "john.doe@example.com",
    phone: "(555) 555-5555"
  },
  shipping: {
    first_name: "John",
    last_name: "Doe",
    address_1: "969 Market",
    address_2: "",
    city: "San Francisco",
    state: "CA",
    postcode: "94103",
    country: "US"
  },
  line_items: [
    {
      product_id: 93,
      quantity: 2
    },
    {
      product_id: 22,
      variation_id: 23,
      quantity: 1
    }
  ],
  shipping_lines: [
    {
      method_id: "flat_rate",
      method_title: "Flat Rate",
      total: "10.00"
    }
  ]
}

woocommerce.post("orders", data).parsed_response

JSON response example:

{
  "id": 154,
  "parent_id": 0,
  "status": "processing",
  "order_key": "wc_order_574cc02467274",
  "number": "154",
  "currency": "USD",
  "version": "2.6.0",
  "prices_include_tax": false,
  "date_created": "2016-05-30T22:35:16",
  "date_modified": "2016-05-30T22:35:16",
  "customer_id": 0,
  "discount_total": "0.00",
  "discount_tax": "0.00",
  "shipping_total": "10.00",
  "shipping_tax": "0.00",
  "cart_tax": "1.95",
  "total": "37.95",
  "total_tax": "1.95",
  "billing": {
    "first_name": "John",
    "last_name": "Doe",
    "company": "",
    "address_1": "969 Market",
    "address_2": "",
    "city": "San Francisco",
    "state": "CA",
    "postcode": "94103",
    "country": "US",
    "email": "john.doe@example.com",
    "phone": "(555) 555-5555"
  },
  "shipping": {
    "first_name": "John",
    "last_name": "Doe",
    "company": "",
    "address_1": "969 Market",
    "address_2": "",
    "city": "San Francisco",
    "state": "CA",
    "postcode": "94103",
    "country": "US"
  },
  "payment_method": "bacs",
  "payment_method_title": "bacs",
  "transaction_id": "",
  "customer_ip_address": "127.0.0.1",
  "customer_user_agent": "curl/7.47.0",
  "created_via": "rest-api",
  "customer_note": "",
  "date_completed": "2016-05-30T19:35:16",
  "date_paid": "2016-05-30 19:35:25",
  "cart_hash": "",
  "line_items": [
    {
      "id": 18,
      "name": "Woo Single #1",
      "sku": "",
      "product_id": 93,
      "variation_id": 0,
      "quantity": 2,
      "tax_class": "",
      "price": "3.00",
      "subtotal": "6.00",
      "subtotal_tax": "0.45",
      "total": "6.00",
      "total_tax": "0.45",
      "taxes": [
        {
          "id": 75,
          "total": 0.45,
          "subtotal": 0.45
        }
      ],
      "meta": []
    },
    {
      "id": 19,
      "name": "Ship Your Idea",
      "sku": "",
      "product_id": 22,
      "variation_id": 23,
      "quantity": 1,
      "tax_class": "",
      "price": "20.00",
      "subtotal": "20.00",
      "subtotal_tax": "1.50",
      "total": "20.00",
      "total_tax": "1.50",
      "taxes": [
        {
          "id": 75,
          "total": 1.5,
          "subtotal": 1.5
        }
      ],
      "meta": [
        {
          "key": "pa_color",
          "label": "Color",
          "value": "Black"
        }
      ]
    }
  ],
  "tax_lines": [
    {
      "id": 21,
      "rate_code": "US-CA-STATE TAX",
      "rate_id": "75",
      "label": "State Tax",
      "compound": false,
      "tax_total": "1.95",
      "shipping_tax_total": "0.00"
    }
  ],
  "shipping_lines": [
    {
      "id": 20,
      "method_title": "Flat Rate",
      "method_id": "flat_rate",
      "total": "10.00",
      "total_tax": "0.00",
      "taxes": []
    }
  ],
  "fee_lines": [],
  "coupon_lines": [],
  "refunds": [],
  "_links": {
    "self": [
      {
        "href": "https://example.com/wp-json/wc/v1/orders/154"
      }
    ],
    "collection": [
      {
        "href": "https://example.com/wp-json/wc/v1/orders"
      }
    ]
  }
}

获取订单

此 API 允许您检索并查看特定订单。

HTTP 请求

GET
/wp-json/wc/v1/orders/<id>
curl https://example.com/wp-json/wc/v1/orders/154 \
    -u consumer_key:consumer_secret
WooCommerce.get("orders/154")
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.log(error.response.data);
  });
<?php print_r($woocommerce->get('orders/154')); ?>
print(wcapi.get("orders/154").json())
woocommerce.get("orders/154").parsed_response

JSON 响应示例:

{
  "id": 154,
  "parent_id": 0,
  "status": "processing",
  "order_key": "wc_order_574cc02467274",
  "number": "154",
  "currency": "USD",
  "version": "2.6.0",
  "prices_include_tax": false,
  "date_created": "2016-05-30T22:35:16",
  "date_modified": "2016-05-30T22:35:16",
  "customer_id": 0,
  "discount_total": "0.00",
  "discount_tax": "0.00",
  "shipping_total": "10.00",
  "shipping_tax": "0.00",
  "cart_tax": "1.95",
  "total": "37.95",
  "total_tax": "1.95",
  "billing": {
    "first_name": "John",
    "last_name": "Doe",
    "company": "",
    "address_1": "969 Market",
    "address_2": "",
    "city": "San Francisco",
    "state": "CA",
    "postcode": "94103",
    "country": "US",
    "email": "john.doe@example.com",
    "phone": "(555) 555-5555"
  },
  "shipping": {
    "first_name": "John",
    "last_name": "Doe",
    "company": "",
    "address_1": "969 Market",
    "address_2": "",
    "city": "San Francisco",
    "state": "CA",
    "postcode": "94103",
    "country": "US"
  },
  "payment_method": "bacs",
  "payment_method_title": "bacs",
  "transaction_id": "",
  "customer_ip_address": "127.0.0.1",
  "customer_user_agent": "curl/7.47.0",
  "created_via": "rest-api",
  "customer_note": "",
  "date_completed": "2016-05-30T19:35:16",
  "date_paid": "2016-05-30 19:35:25",
  "cart_hash": "",
  "line_items": [
    {
      "id": 18,
      "name": "Woo Single #1",
      "sku": "",
      "product_id": 93,
      "variation_id": 0,
      "quantity": 2,
      "tax_class": "",
      "price": "3.00",
      "subtotal": "6.00",
      "subtotal_tax": "0.45",
      "total": "6.00",
      "total_tax": "0.45",
      "taxes": [
        {
          "id": 75,
          "total": 0.45,
          "subtotal": 0.45
        }
      ],
      "meta": []
    },
    {
      "id": 19,
      "name": "Ship Your Idea",
      "sku": "",
      "product_id": 22,
      "variation_id": 23,
      "quantity": 1,
      "tax_class": "",
      "price": "20.00",
      "subtotal": "20.00",
      "subtotal_tax": "1.50",
      "total": "20.00",
      "total_tax": "1.50",
      "taxes": [
        {
          "id": 75,
          "total": 1.5,
          "subtotal": 1.5
        }
      ],
      "meta": [
        {
          "key": "pa_color",
          "label": "Color",
          "value": "Black"
        }
      ]
    }
  ],
  "tax_lines": [
    {
      "id": 21,
      "rate_code": "US-CA-STATE TAX",
      "rate_id": "75",
      "label": "State Tax",
      "compound": false,
      "tax_total": "1.95",
      "shipping_tax_total": "0.00"
    }
  ],
  "shipping_lines": [
    {
      "id": 20,
      "method_title": "Flat Rate",
      "method_id": "flat_rate",
      "total": "10.00",
      "total_tax": "0.00",
      "taxes": []
    }
  ],
  "fee_lines": [],
  "coupon_lines": [],
  "refunds": [],
  "_links": {
    "self": [
      {
        "href": "https://example.com/wp-json/wc/v1/orders/154"
      }
    ],
    "collection": [
      {
        "href": "https://example.com/wp-json/wc/v1/orders"
      }
    ]
  }
}

Available parameters

Parameter Type Description
dp string Number of decimal points to use in each resource.

列出所有订单

此 API 可帮助您查看所有订单。

HTTP 请求

GET
/wp-json/wc/v1/orders
curl https://example.com/wp-json/wc/v1/orders \
    -u consumer_key:consumer_secret
WooCommerce.get("orders")
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.log(error.response.data);
  });
<?php print_r($woocommerce->get('orders')); ?>
print(wcapi.get("orders").json())
woocommerce.get("orders").parsed_response

JSON 响应示例:

[
  {
    "id": 154,
    "parent_id": 0,
    "status": "processing",
    "order_key": "wc_order_574cc02467274",
    "number": "154",
    "currency": "USD",
    "version": "2.6.0",
    "prices_include_tax": false,
    "date_created": "2016-05-30T22:35:16",
    "date_modified": "2016-05-30T22:35:16",
    "customer_id": 0,
    "discount_total": "0.00",
    "discount_tax": "0.00",
    "shipping_total": "10.00",
    "shipping_tax": "0.00",
    "cart_tax": "1.95",
    "total": "37.95",
    "total_tax": "1.95",
    "billing": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US",
      "email": "john.doe@example.com",
      "phone": "(555) 555-5555"
    },
    "shipping": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US"
    },
    "payment_method": "bacs",
    "payment_method_title": "bacs",
    "transaction_id": "",
    "customer_ip_address": "127.0.0.1",
    "customer_user_agent": "curl/7.47.0",
    "created_via": "rest-api",
    "customer_note": "",
    "date_completed": "2016-05-30T19:35:16",
    "date_paid": "2016-05-30 19:35:25",
    "cart_hash": "",
    "line_items": [
      {
        "id": 18,
        "name": "Woo Single #1",
        "sku": "",
        "product_id": 93,
        "variation_id": 0,
        "quantity": 2,
        "tax_class": "",
        "price": "3.00",
        "subtotal": "6.00",
        "subtotal_tax": "0.45",
        "total": "6.00",
        "total_tax": "0.45",
        "taxes": [
          {
            "id": 75,
            "total": 0.45,
            "subtotal": 0.45
          }
        ],
        "meta": []
      },
      {
        "id": 19,
        "name": "Ship Your Idea",
        "sku": "",
        "product_id": 22,
        "variation_id": 23,
        "quantity": 1,
        "tax_class": "",
        "price": "20.00",
        "subtotal": "20.00",
        "subtotal_tax": "1.50",
        "total": "20.00",
        "total_tax": "1.50",
        "taxes": [
          {
            "id": 75,
            "total": 1.5,
            "subtotal": 1.5
          }
        ],
        "meta": [
          {
            "key": "pa_color",
            "label": "Color",
            "value": "Black"
          }
        ]
      }
    ],
    "tax_lines": [
      {
        "id": 21,
        "rate_code": "US-CA-STATE TAX",
        "rate_id": "75",
        "label": "State Tax",
        "compound": false,
        "tax_total": "1.95",
        "shipping_tax_total": "0.00"
      }
    ],
    "shipping_lines": [
      {
        "id": 20,
        "method_title": "Flat Rate",
        "method_id": "flat_rate",
        "total": "10.00",
        "total_tax": "0.00",
        "taxes": []
      }
    ],
    "fee_lines": [],
    "coupon_lines": [],
    "refunds": [],
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v1/orders/154"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v1/orders"
        }
      ]
    }
  },
  {
    "id": 116,
    "parent_id": 0,
    "status": "processing",
    "order_key": "wc_order_5728e6e53d2a4",
    "number": "116",
    "currency": "USD",
    "version": "2.6.0",
    "prices_include_tax": false,
    "date_created": "2016-05-03T17:59:00",
    "date_modified": "2016-05-30T22:37:31",
    "customer_id": 1,
    "discount_total": "0.00",
    "discount_tax": "0.00",
    "shipping_total": "10.00",
    "shipping_tax": "0.00",
    "cart_tax": "0.00",
    "total": "14.00",
    "total_tax": "0.00",
    "billing": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US",
      "email": "john.doe@claudiosmweb.com",
      "phone": "(555) 555-5555"
    },
    "shipping": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US"
    },
    "payment_method": "bacs",
    "payment_method_title": "Direct Bank Transfer",
    "transaction_id": "",
    "customer_ip_address": "127.0.0.1",
    "customer_user_agent": "curl/7.47.0",
    "created_via": "",
    "customer_note": "",
    "date_completed": "2016-05-30T19:35:16",
    "date_paid": "2016-05-03 14:59:12",
    "cart_hash": "",
    "line_items": [
      {
        "id": 6,
        "name": "Woo Single #2",
        "sku": "12345",
        "product_id": 99,
        "variation_id": 0,
        "quantity": 2,
        "tax_class": "",
        "price": "2.00",
        "subtotal": "4.00",
        "subtotal_tax": "0.00",
        "total": "4.00",
        "total_tax": "0.00",
        "taxes": [],
        "meta": []
      }
    ],
    "tax_lines": [],
    "shipping_lines": [
      {
        "id": 7,
        "method_title": "Flat Rate",
        "method_id": "flat_rate",
        "total": "10.00",
        "total_tax": "0.00",
        "taxes": []
      }
    ],
    "fee_lines": [],
    "coupon_lines": [],
    "refunds": [],
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v1/orders/116"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v1/orders"
        }
      ],
      "customer": [
        {
          "href": "https://example.com/wp-json/wc/v1/customers/1"
        }
      ]
    }
  }
]

可用参数

Parameter Type Description
context string Scope under which the request is made; determines fields present in response. Options: view and edit.
page integer Current page of the collection.
per_page integer Maximum number of items to be returned in result set.
search string Limit results to those matching a string.
after string Limit response to resources published after a given ISO8601 compliant date.
before string Limit response to resources published before a given ISO8601 compliant date.
dates_are_gmt boolean Interpret after and before as UTC dates when true.
exclude string Ensure result set excludes specific ids.
include string Limit result set to specific ids.
offset integer Offset the result set by a specific number of items.
order string Order sort attribute ascending or descending. Default is asc. Options: asc and desc.
orderby string Sort collection by object attribute. Default is date, Options: date, id, include, title and slug.
status string Limit result set to orders assigned a specific status. Default is any. Options (plugins may add new status): any, pending, processing, on-hold, completed, cancelled, refunded and failed.
customer string Limit result set to orders assigned a specific customer.
product string Limit result set to orders assigned a specific product.
dp string Number of decimal points to use in each resource.

更新订单

此 API 允许您修改订单。

HTTP 请求

PUT
/wp-json/wc/v1/orders/<id>
curl -X PUT https://example.com/wp-json/wc/v1/orders/154 \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "status": "completed"
}'
const data = {
  status: "completed"
};

WooCommerce.put("orders/154", data)
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.log(error.response.data);
  });
<?php
$data = [
    'status' => 'completed'
];

print_r($woocommerce->put('orders/154', $data));
?>
data = {
    "status": "completed"
}

print(wcapi.put("orders/154", data).json())
data = {
  status: "completed"
}

woocommerce.put("orders/154", data).parsed_response

JSON 响应示例:

{
  "id": 154,
  "parent_id": 0,
  "status": "completed",
  "order_key": "wc_order_574cc02467274",
  "number": "154",
  "currency": "USD",
  "version": "2.6.0",
  "prices_include_tax": false,
  "date_created": "2016-05-30T22:35:16",
  "date_modified": "2016-05-30T22:46:16",
  "customer_id": 0,
  "discount_total": "0.00",
  "discount_tax": "0.00",
  "shipping_total": "10.00",
  "shipping_tax": "0.00",
  "cart_tax": "1.95",
  "total": "37.95",
  "total_tax": "1.95",
  "billing": {
    "first_name": "John",
    "last_name": "Doe",
    "company": "",
    "address_1": "969 Market",
    "address_2": "",
    "city": "San Francisco",
    "state": "CA",
    "postcode": "94103",
    "country": "US",
    "email": "john.doe@example.com",
    "phone": "(555) 555-5555"
  },
  "shipping": {
    "first_name": "John",
    "last_name": "Doe",
    "company": "",
    "address_1": "969 Market",
    "address_2": "",
    "city": "San Francisco",
    "state": "CA",
    "postcode": "94103",
    "country": "US"
  },
  "payment_method": "bacs",
  "payment_method_title": "bacs",
  "transaction_id": "",
  "customer_ip_address": "127.0.0.1",
  "customer_user_agent": "curl/7.47.0",
  "created_via": "rest-api",
  "customer_note": "",
  "date_completed": "2016-05-30T19:47:46",
  "date_paid": "2016-05-30 19:35:25",
  "cart_hash": "",
  "line_items": [
    {
      "id": 18,
      "name": "Woo Single #1",
      "sku": "",
      "product_id": 93,
      "variation_id": 0,
      "quantity": 2,
      "tax_class": "",
      "price": "3.00",
      "subtotal": "6.00",
      "subtotal_tax": "0.45",
      "total": "6.00",
      "total_tax": "0.45",
      "taxes": [
        {
          "id": 75,
          "total": 0.45,
          "subtotal": 0.45
        }
      ],
      "meta": []
    },
    {
      "id": 19,
      "name": "Ship Your Idea",
      "sku": "",
      "product_id": 22,
      "variation_id": 23,
      "quantity": 1,
      "tax_class": "",
      "price": "20.00",
      "subtotal": "20.00",
      "subtotal_tax": "1.50",
      "total": "20.00",
      "total_tax": "1.50",
      "taxes": [
        {
          "id": 75,
          "total": 1.5,
          "subtotal": 1.5
        }
      ],
      "meta": [
        {
          "key": "pa_color",
          "label": "Color",
          "value": "Black"
        }
      ]
    }
  ],
  "tax_lines": [
    {
      "id": 21,
      "rate_code": "US-CA-STATE TAX",
      "rate_id": "75",
      "label": "State Tax",
      "compound": false,
      "tax_total": "1.95",
      "shipping_tax_total": "0.00"
    }
  ],
  "shipping_lines": [
    {
      "id": 20,
      "method_title": "Flat Rate",
      "method_id": "flat_rate",
      "total": "10.00",
      "total_tax": "0.00",
      "taxes": []
    }
  ],
  "fee_lines": [],
  "coupon_lines": [],
  "refunds": [],
  "_links": {
    "self": [
      {
        "href": "https://example.com/wp-json/wc/v1/orders/154"
      }
    ],
    "collection": [
      {
        "href": "https://example.com/wp-json/wc/v1/orders"
      }
    ]
  }
}

删除订单

此 API 可帮助您删除订单。

HTTP 请求

DELETE
/wp-json/wc/v1/orders/<id>
curl -X DELETE https://example.com/wp-json/wc/v1/orders/154?force=true \
    -u consumer_key:consumer_secret
WooCommerce.delete("orders/154", {
  force: true
})
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.log(error.response.data);
  });
<?php print_r($woocommerce->delete('orders/154', ['force' => true])); ?>
print(wcapi.delete("orders/154", params={"force": True}).json())
woocommerce.delete("orders/154", force: true).parsed_response

JSON 响应示例:

{
  "id": 154,
  "parent_id": 0,
  "status": "completed",
  "order_key": "wc_order_574cc02467274",
  "number": "154",
  "currency": "USD",
  "version": "2.6.0",
  "prices_include_tax": false,
  "date_created": "2016-05-30T22:35:16",
  "date_modified": "2016-05-30T22:46:16",
  "customer_id": 0,
  "discount_total": "0.00",
  "discount_tax": "0.00",
  "shipping_total": "10.00",
  "shipping_tax": "0.00",
  "cart_tax": "1.95",
  "total": "37.95",
  "total_tax": "1.95",
  "billing": {
    "first_name": "John",
    "last_name": "Doe",
    "company": "",
    "address_1": "969 Market",
    "address_2": "",
    "city": "San Francisco",
    "state": "CA",
    "postcode": "94103",
    "country": "US",
    "email": "john.doe@example.com",
    "phone": "(555) 555-5555"
  },
  "shipping": {
    "first_name": "John",
    "last_name": "Doe",
    "company": "",
    "address_1": "969 Market",
    "address_2": "",
    "city": "San Francisco",
    "state": "CA",
    "postcode": "94103",
    "country": "US"
  },
  "payment_method": "bacs",
  "payment_method_title": "bacs",
  "transaction_id": "",
  "customer_ip_address": "127.0.0.1",
  "customer_user_agent": "curl/7.47.0",
  "created_via": "rest-api",
  "customer_note": "",
  "date_completed": "2016-05-30T19:47:46",
  "date_paid": "2016-05-30 19:35:25",
  "cart_hash": "",
  "line_items": [
    {
      "id": 18,
      "name": "Woo Single #1",
      "sku": "",
      "product_id": 93,
      "variation_id": 0,
      "quantity": 2,
      "tax_class": "",
      "price": "3.00",
      "subtotal": "6.00",
      "subtotal_tax": "0.45",
      "total": "6.00",
      "total_tax": "0.45",
      "taxes": [
        {
          "id": 75,
          "total": 0.45,
          "subtotal": 0.45
        }
      ],
      "meta": []
    },
    {
      "id": 19,
      "name": "Ship Your Idea",
      "sku": "",
      "product_id": 22,
      "variation_id": 23,
      "quantity": 1,
      "tax_class": "",
      "price": "20.00",
      "subtotal": "20.00",
      "subtotal_tax": "1.50",
      "total": "20.00",
      "total_tax": "1.50",
      "taxes": [
        {
          "id": 75,
          "total": 1.5,
          "subtotal": 1.5
        }
      ],
      "meta": [
        {
          "key": "pa_color",
          "label": "Color",
          "value": "Black"
        }
      ]
    }
  ],
  "tax_lines": [
    {
      "id": 21,
      "rate_code": "US-CA-STATE TAX",
      "rate_id": "75",
      "label": "State Tax",
      "compound": false,
      "tax_total": "1.95",
      "shipping_tax_total": "0.00"
    }
  ],
  "shipping_lines": [
    {
      "id": 20,
      "method_title": "Flat Rate",
      "method_id": "flat_rate",
      "total": "10.00",
      "total_tax": "0.00",
      "taxes": []
    }
  ],
  "fee_lines": [],
  "coupon_lines": [],
  "refunds": [],
  "_links": {
    "self": [
      {
        "href": "https://example.com/wp-json/wc/v1/orders/154"
      }
    ],
    "collection": [
      {
        "href": "https://example.com/wp-json/wc/v1/orders"
      }
    ]
  }
}

Available parameters

Parameter Type Description
force string Use true whether to permanently delete the order, Default is false.

批量更新订单

此 API 可帮助您批量创建、更新和删除多个订单。

HTTP request

POST
/wp-json/wc/v1/orders/batch
curl -X POST https://example.com/wp-json/wc/v1/orders/batch \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "create": [
    {
      "payment_method": "bacs",
      "payment_method_title": "Direct Bank Transfer",
      "billing": {
        "first_name": "John",
        "last_name": "Doe",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US",
        "email": "john.doe@example.com",
        "phone": "(555) 555-5555"
      },
      "shipping": {
        "first_name": "John",
        "last_name": "Doe",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      },
      "line_items": [
        {
          "product_id": 79,
          "quantity": 1
        },
        {
          "product_id": 93,
          "quantity": 1
        },
        {
          "product_id": 22,
          "variation_id": 23,
          "quantity": 1
        }
      ],
      "shipping_lines": [
        {
          "method_id": "flat_rate",
          "method_title": "Flat Rate",
          "total": "30.00"
        }
      ]
    },
    {
      "payment_method": "bacs",
      "payment_method_title": "Direct Bank Transfer",
      "set_paid": true,
      "billing": {
        "first_name": "John",
        "last_name": "Doe",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US",
        "email": "john.doe@example.com",
        "phone": "(555) 555-5555"
      },
      "shipping": {
        "first_name": "John",
        "last_name": "Doe",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      },
      "line_items": [
        {
          "product_id": 22,
          "variation_id": 23,
          "quantity": 1
        },
        {
          "product_id": 22,
          "variation_id": 24,
          "quantity": 1
        }
      ],
      "shipping_lines": [
        {
          "method_id": "flat_rate",
          "method_title": "Flat Rate",
          "total": "20.00"
        }
      ]
    }
  ],
  "update": [
    {
      "id": 154,
      "shipping_methods": "Local Delivery"
    }
  ],
  "delete": [
    154
  ]
}'
const data = {
  create: [
    {
      payment_method: "bacs",
      payment_method_title: "Direct Bank Transfer",
      billing: {
        first_name: "John",
        last_name: "Doe",
        address_1: "969 Market",
        address_2: "",
        city: "San Francisco",
        state: "CA",
        postcode: "94103",
        country: "US",
        email: "john.doe@example.com",
        phone: "(555) 555-5555"
      },
      shipping: {
        first_name: "John",
        last_name: "Doe",
        address_1: "969 Market",
        address_2: "",
        city: "San Francisco",
        state: "CA",
        postcode: "94103",
        country: "US"
      },
      line_items: [
        {
          product_id: 79,
          quantity: 1
        },
        {
          product_id: 93,
          quantity: 1
        },
        {
          product_id: 22,
          variation_id: 23,
          quantity: 1
        }
      ],
      shipping_lines: [
        {
          method_id: "flat_rate",
          method_title: "Flat Rate",
          total: "30.00"
        }
      ]
    },
    {
      payment_method: "bacs",
      payment_method_title: "Direct Bank Transfer",
      set_paid: true,
      billing: {
        first_name: "John",
        last_name: "Doe",
        address_1: "969 Market",
        address_2: "",
        city: "San Francisco",
        state: "CA",
        postcode: "94103",
        country: "US",
        email: "john.doe@example.com",
        phone: "(555) 555-5555"
      },
      shipping: {
        first_name: "John",
        last_name: "Doe",
        address_1: "969 Market",
        address_2: "",
        city: "San Francisco",
        state: "CA",
        postcode: "94103",
        country: "US"
      },
      line_items: [
        {
          product_id: 22,
          variation_id: 23,
          quantity: 1
        },
        {
          product_id: 22,
          variation_id: 24,
          quantity: 1
        }
      ],
      shipping_lines: [
        {
          method_id: "flat_rate",
          method_title: "Flat Rate",
          total: "20.00"
        }
      ]
    }
  ],
  update: [
    {
      id: 154,
      shipping_methods: "Local Delivery"
    }
  ],
  delete: [
    154
  ]
};

WooCommerce.post("orders/batch", data)
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.log(error.response.data);
  });
<?php
$data = [
    'create' => [
        [
            'payment_method' => 'bacs',
            'payment_method_title' => '直接银行转账',
            'billing' => [
                'first_name' => 'John',
                'last_name' => 'Doe',
                'address_1' => '969 Market',
                'address_2' => '',
                'city' => 'San Francisco',
                'state' => 'CA',
                'postcode' => '94103',
                'country' => 'US',
                'email' => 'john.doe@example.com',
                'phone' => '(555) 555-5555'
            ],
            'shipping' => [
                'first_name' => 'John',
                'last_name' => 'Doe',
                'address_1' => '969 Market',
                'address_2' => '',
                'city' => 'San Francisco',
                'state' => 'CA',
                'postcode' => '94103',
                'country' => 'US'
            ],
            'line_items' => [
                [
                    'product_id' => 79,
                    'quantity' => 1
                ],
                [
                    'product_id' => 93,
                    'quantity' => 1
                ],
                [
                    'product_id' => 22,
                    'variation_id' => 23,
                    'quantity' => 1
                ]
            ],
            'shipping_lines' => [
                [
                    'method_id' => 'flat_rate',
                    'method_title' => '统一运费',
                    'total' => '30.00'
                ]
            ]
        ],
        [
            'payment_method' => 'bacs',
            'payment_method_title' => '直接银行转账',
            'set_paid' => true,
            'billing' => [
                'first_name' => 'John',
                'last_name' => 'Doe',
                'address_1' => '969 Market',
                'address_2' => '',
                'city' => 'San Francisco',
                'state' => 'CA',
                'postcode' => '94103',
                'country' => 'US',
                'email' => 'john.doe@example.com',
                'phone' => '(555) 555-5555'
            ],
            'shipping' => [
                'first_name' => 'John',
                'last_name' => 'Doe',
                'address_1' => '969 Market',
                'address_2' => '',
                'city' => 'San Francisco',
                'state' => 'CA',
                'postcode' => '94103',
                'country' => 'US'
            ],
            'line_items' => [
                [
                    'product_id' => 22,
                    'variation_id' => 23,
                    'quantity' => 1
                ],
                [
                    'product_id' => 22,
                    'variation_id' => 24,
                    'quantity' => 1
                ]
            ],
            'shipping_lines' => [
                [
                    'method_id' => 'flat_rate',
                    'method_title' => '统一运费',
                    'total' => '20.00'
                ]
            ]
        ]
    ],
    'update' => [
        [
            'id' => 154,
            'shipping_methods' => '本地配送'
        ]
    ],
    'delete' => [
        154
    ]
];

print_r($woocommerce->post('orders/batch', $data));
?>
data = {
    "create": [
        {
            "payment_method": "bacs",
            "payment_method_title": "Direct Bank Transfer",
            "billing": {
                "first_name": "John",
                "last_name": "Doe",
                "address_1": "969 Market",
                "address_2": "",
                "city": "San Francisco",
                "state": "CA",
                "postcode": "94103",
                "country": "US",
                "email": "john.doe@example.com",
                "phone": "(555) 555-5555"
            },
            "shipping": {
                "first_name": "John",
                "last_name": "Doe",
                "address_1": "969 Market",
                "address_2": "",
                "city": "San Francisco",
                "state": "CA",
                "postcode": "94103",
                "country": "US"
            },
            "line_items": [
                {
                    "product_id": 79,
                    "quantity": 1
                },
                {
                    "product_id": 93,
                    "quantity": 1
                },
                {
                    "product_id": 22,
                    "variation_id": 23,
                    "quantity": 1
                }
            ],
            "shipping_lines": [
                {
                    "method_id": "flat_rate",
                    "method_title": "Flat Rate",
                    "total": "30.00"
                }
            ]
        },
        {
            "payment_method": "bacs",
            "payment_method_title": "Direct Bank Transfer",
            "set_paid": True,
            "billing": {
                "first_name": "John",
                "last_name": "Doe",
                "address_1": "969 Market",
                "address_2": "",
                "city": "San Francisco",
                "state": "CA",
                "postcode": "94103",
                "country": "US",
                "email": "john.doe@example.com",
                "phone": "(555) 555-5555"
            },
            "shipping": {
                "first_name": "John",
                "last_name": "Doe",
                "address_1": "969 Market",
                "address_2": "",
                "city": "San Francisco",
                "state": "CA",
                "postcode": "94103",
                "country": "US"
            },
            "line_items": [
                {
                    "product_id": 22,
                    "variation_id": 23,
                    "quantity": 1
                },
                {
                    "product_id": 22,
                    "variation_id": 24,
                    "quantity": 1
                }
            ],
            "shipping_lines": [
                {
                    "method_id": "flat_rate",
                    "method_title": "Flat Rate",
                    "total": "20.00"
                }
            ]
        }
    ],
    "update": [
        {
            "id": 154,
            "shipping_methods": "Local Delivery"
        }
    ],
    "delete": [
        154
    ]
}

print(wcapi.post("orders/batch", data).json())
data = {
  create: [
    {
      payment_method: "bacs",
      payment_method_title: "Direct Bank Transfer",
      billing: {
        first_name: "John",
        last_name: "Doe",
        address_1: "969 Market",
        address_2: "",
        city: "San Francisco",
        state: "CA",
        postcode: "94103",
        country: "US",
        email: "john.doe@example.com",
        phone: "(555) 555-5555"
      },
      shipping: {
        first_name: "John",
        last_name: "Doe",
        address_1: "969 Market",
        address_2: "",
        city: "San Francisco",
        state: "CA",
        postcode: "94103",
        country: "US"
      },
      line_items: [
        {
          product_id: 79,
          quantity: 1
        },
        {
          product_id: 93,
          quantity: 1
        },
        {
          product_id: 22,
          variation_id: 23,
          quantity: 1
        }
      ],
      shipping_lines: [
        {
          method_id: "flat_rate",
          method_title: "Flat Rate",
          total: "30.00"
        }
      ]
    },
    {
      payment_method: "bacs",
      payment_method_title: "Direct Bank Transfer",
      set_paid: true,
      billing: {
        first_name: "John",
        last_name: "Doe",
        address_1: "969 Market",
        address_2: "",
        city: "San Francisco",
        state: "CA",
        postcode: "94103",
        country: "US",
        email: "john.doe@example.com",
        phone: "(555) 555-5555"
      },
      shipping: {
        first_name: "John",
        last_name: "Doe",
        address_1: "969 Market",
        address_2: "",
        city: "San Francisco",
        state: "CA",
        postcode: "94103",
        country: "US"
      },
      line_items: [
        {
          product_id: 22,
          variation_id: 23,
          quantity: 1
        },
        {
          product_id: 22,
          variation_id: 24,
          quantity: 1
        }
      ],
      shipping_lines: [
        {
          method_id: "flat_rate",
          method_title: "Flat Rate",
          total: "20.00"
        }
      ]
    }
  ],
  update: [
    {
      id: 154,
      shipping_methods: "Local Delivery"
    }
  ],
  delete: [
    154
  ]
}

woocommerce.post("orders/batch", data).parsed_response

JSON 响应示例:

{
  "create": [
    {
      "id": 155,
      "parent_id": 0,
      "status": "pending",
      "order_key": "wc_order_574cc9541cea3",
      "number": "155",
      "currency": "USD",
      "version": "2.6.0",
      "prices_include_tax": false,
      "date_created": "2016-05-30T23:14:28",
      "date_modified": "2016-05-30T23:14:28",
      "customer_id": 0,
      "discount_total": "0.00",
      "discount_tax": "0.00",
      "shipping_total": "30.00",
      "shipping_tax": "0.00",
      "cart_tax": "2.85",
      "total": "70.85",
      "total_tax": "2.85",
      "billing": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US",
        "email": "john.doe@example.com",
        "phone": "(555) 555-5555"
      },
      "shipping": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      },
      "payment_method": "bacs",
      "payment_method_title": "bacs",
      "transaction_id": "",
      "customer_ip_address": "127.0.0.1",
      "customer_user_agent": "curl/7.47.0",
      "created_via": "rest-api",
      "customer_note": "",
      "date_completed": "2016-05-30T20:14:28",
      "date_paid": "",
      "cart_hash": "",
      "line_items": [
        {
          "id": 22,
          "name": "Woo Logo",
          "sku": "",
          "product_id": 79,
          "variation_id": 0,
          "quantity": 1,
          "tax_class": "",
          "price": "15.00",
          "subtotal": "15.00",
          "subtotal_tax": "1.13",
          "total": "15.00",
          "total_tax": "1.13",
          "taxes": [
            {
              "id": 75,
              "total": 1.125,
              "subtotal": 1.125
            }
          ],
          "meta": []
        },
        {
          "id": 23,
          "name": "Woo Single #1",
          "sku": "",
          "product_id": 93,
          "variation_id": 0,
          "quantity": 1,
          "tax_class": "",
          "price": "3.00",
          "subtotal": "3.00",
          "subtotal_tax": "0.23",
          "total": "3.00",
          "total_tax": "0.23",
          "taxes": [
            {
              "id": 75,
              "total": 0.225,
              "subtotal": 0.225
            }
          ],
          "meta": []
        },
        {
          "id": 24,
          "name": "Ship Your Idea",
          "sku": "",
          "product_id": 22,
          "variation_id": 23,
          "quantity": 1,
          "tax_class": "",
          "price": "20.00",
          "subtotal": "20.00",
          "subtotal_tax": "1.50",
          "total": "20.00",
          "total_tax": "1.50",
          "taxes": [
            {
              "id": 75,
              "total": 1.5,
              "subtotal": 1.5
            }
          ],
          "meta": [
            {
              "key": "pa_color",
              "label": "Color",
              "value": "Black"
            }
          ]
        }
      ],
      "tax_lines": [
        {
          "id": 26,
          "rate_code": "US-CA-STATE TAX",
          "rate_id": "75",
          "label": "State Tax",
          "compound": false,
          "tax_total": "2.85",
          "shipping_tax_total": "0.00"
        }
      ],
      "shipping_lines": [
        {
          "id": 25,
          "method_title": "Flat Rate",
          "method_id": "flat_rate",
          "total": "30.00",
          "total_tax": "0.00",
          "taxes": []
        }
      ],
      "fee_lines": [],
      "coupon_lines": [],
      "refunds": [],
      "_links": {
        "self": [
          {
            "href": "https://example.com/wp-json/wc/v1/orders/155"
          }
        ],
        "collection": [
          {
            "href": "https://example.com/wp-json/wc/v1/orders"
          }
        ]
      }
    },
    {
      "id": 156,
      "parent_id": 0,
      "status": "processing",
      "order_key": "wc_order_574cc95465214",
      "number": "156",
      "currency": "USD",
      "version": "2.6.0",
      "prices_include_tax": false,
      "date_created": "2016-05-30T23:14:28",
      "date_modified": "2016-05-30T23:14:28",
      "customer_id": 0,
      "discount_total": "0.00",
      "discount_tax": "0.00",
      "shipping_total": "20.00",
      "shipping_tax": "0.00",
      "cart_tax": "3.00",
      "total": "63.00",
      "total_tax": "3.00",
      "billing": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US",
        "email": "john.doe@example.com",
        "phone": "(555) 555-5555"
      },
      "shipping": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      },
      "payment_method": "bacs",
      "payment_method_title": "bacs",
      "transaction_id": "",
      "customer_ip_address": "127.0.0.1",
      "customer_user_agent": "curl/7.47.0",
      "created_via": "rest-api",
      "customer_note": "",
      "date_completed": "2016-05-30T20:14:28",
      "date_paid": "2016-05-30 20:14:37",
      "cart_hash": "",
      "line_items": [
        {
          "id": 27,
          "name": "Ship Your Idea",
          "sku": "",
          "product_id": 22,
          "variation_id": 23,
          "quantity": 1,
          "tax_class": "",
          "price": "20.00",
          "subtotal": "20.00",
          "subtotal_tax": "1.50",
          "total": "20.00",
          "total_tax": "1.50",
          "taxes": [
            {
              "id": 75,
              "total": 1.5,
              "subtotal": 1.5
            }
          ],
          "meta": [
            {
              "key": "pa_color",
              "label": "Color",
              "value": "Black"
            }
          ]
        },
        {
          "id": 28,
          "name": "Ship Your Idea",
          "sku": "",
          "product_id": 22,
          "variation_id": 24,
          "quantity": 1,
          "tax_class": "",
          "price": "20.00",
          "subtotal": "20.00",
          "subtotal_tax": "1.50",
          "total": "20.00",
          "total_tax": "1.50",
          "taxes": [
            {
              "id": 75,
              "total": 1.5,
              "subtotal": 1.5
            }
          ],
          "meta": [
            {
              "key": "pa_color",
              "label": "Color",
              "value": "Green"
            }
          ]
        }
      ],
      "tax_lines": [
        {
          "id": 30,
          "rate_code": "US-CA-STATE TAX",
          "rate_id": "75",
          "label": "State Tax",
          "compound": false,
          "tax_total": "3.00",
          "shipping_tax_total": "0.00"
        }
      ],
      "shipping_lines": [
        {
          "id": 29,
          "method_title": "Flat Rate",
          "method_id": "flat_rate",
          "total": "20.00",
          "total_tax": "0.00",
          "taxes": []
        }
      ],
      "fee_lines": [],
      "coupon_lines": [],
      "refunds": [],
      "_links": {
        "self": [
          {
            "href": "https://example.com/wp-json/wc/v1/orders/156"
          }
        ],
        "collection": [
          {
            "href": "https://example.com/wp-json/wc/v1/orders"
          }
        ]
      }
    }
  ],
  "update": [
    {
      "id": 154,
      "parent_id": 0,
      "status": "completed",
      "order_key": "wc_order_574cc02467274",
      "number": "154",
      "currency": "USD",
      "version": "2.6.0",
      "prices_include_tax": false,
      "date_created": "2016-05-30T22:35:16",
      "date_modified": "2016-05-30T22:55:19",
      "customer_id": 0,
      "discount_total": "0.00",
      "discount_tax": "0.00",
      "shipping_total": "10.00",
      "shipping_tax": "0.00",
      "cart_tax": "1.95",
      "total": "37.95",
      "total_tax": "1.95",
      "billing": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US",
        "email": "john.doe@example.com",
        "phone": "(555) 555-5555"
      },
      "shipping": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      },
      "payment_method": "bacs",
      "payment_method_title": "bacs",
      "transaction_id": "",
      "customer_ip_address": "127.0.0.1",
      "customer_user_agent": "curl/7.47.0",
      "created_via": "rest-api",
      "customer_note": "",
      "date_completed": "2016-05-30T19:47:46",
      "date_paid": "2016-05-30 19:35:25",
      "cart_hash": "",
      "line_items": [
        {
          "id": 18,
          "name": "Woo Single #1",
          "sku": "",
          "product_id": 93,
          "variation_id": 0,
          "quantity": 2,
          "tax_class": "",
          "price": "3.00",
          "subtotal": "6.00",
          "subtotal_tax": "0.45",
          "total": "6.00",
          "total_tax": "0.45",
          "taxes": [
            {
              "id": 75,
              "total": 0.45,
              "subtotal": 0.45
            }
          ],
          "meta": []
        },
        {
          "id": 19,
          "name": "Ship Your Idea",
          "sku": "",
          "product_id": 22,
          "variation_id": 23,
          "quantity": 1,
          "tax_class": "",
          "price": "20.00",
          "subtotal": "20.00",
          "subtotal_tax": "1.50",
          "total": "20.00",
          "total_tax": "1.50",
          "taxes": [
            {
              "id": 75,
              "total": 1.5,
              "subtotal": 1.5
            }
          ],
          "meta": [
            {
              "key": "pa_color",
              "label": "Color",
              "value": "Black"
            }
          ]
        }
      ],
      "tax_lines": [
        {
          "id": 21,
          "rate_code": "US-CA-STATE TAX",
          "rate_id": "75",
          "label": "State Tax",
          "compound": false,
          "tax_total": "1.95",
          "shipping_tax_total": "0.00"
        }
      ],
      "shipping_lines": [
        {
          "id": 20,
          "method_title": "Flat Rate",
          "method_id": "flat_rate",
          "total": "10.00",
          "total_tax": "0.00",
          "taxes": []
        }
      ],
      "fee_lines": [],
      "coupon_lines": [],
      "refunds": [],
      "_links": {
        "self": [
          {
            "href": "https://example.com/wp-json/wc/v1/orders/154"
          }
        ],
        "collection": [
          {
            "href": "https://example.com/wp-json/wc/v1/orders"
          }
        ]
      }
    }
  ],
  "delete": [
    {
      "id": 154,
      "parent_id": 0,
      "status": "completed",
      "order_key": "wc_order_574cc02467274",
      "number": "154",
      "currency": "USD",
      "version": "2.6.0",
      "prices_include_tax": false,
      "date_created": "2016-05-30T22:35:16",
      "date_modified": "2016-05-30T22:55:19",
      "customer_id": 0,
      "discount_total": "0.00",
      "discount_tax": "0.00",
      "shipping_total": "10.00",
      "shipping_tax": "0.00",
      "cart_tax": "1.95",
      "total": "37.95",
      "total_tax": "1.95",
      "billing": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US",
        "email": "john.doe@example.com",
        "phone": "(555) 555-5555"
      },
      "shipping": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      },
      "payment_method": "bacs",
      "payment_method_title": "bacs",
      "transaction_id": "",
      "customer_ip_address": "127.0.0.1",
      "customer_user_agent": "curl/7.47.0",
      "created_via": "rest-api",
      "customer_note": "",
      "date_completed": "2016-05-30T19:47:46",
      "date_paid": "2016-05-30 19:35:25",
      "cart_hash": "",
      "line_items": [
        {
          "id": 18,
          "name": "Woo Single #1",
          "sku": "",
          "product_id": 93,
          "variation_id": 0,
          "quantity": 2,
          "tax_class": "",
          "price": "3.00",
          "subtotal": "6.00",
          "subtotal_tax": "0.45",
          "total": "6.00",
          "total_tax": "0.45",
          "taxes": [
            {
              "id": 75,
              "total": 0.45,
              "subtotal": 0.45
            }
          ],
          "meta": []
        },
        {
          "id": 19,
          "name": "Ship Your Idea",
          "sku": "",
          "product_id": 22,
          "variation_id": 23,
          "quantity": 1,
          "tax_class": "",
          "price": "20.00",
          "subtotal": "20.00",
          "subtotal_tax": "1.50",
          "total": "20.00",
          "total_tax": "1.50",
          "taxes": [
            {
              "id": 75,
              "total": 1.5,
              "subtotal": 1.5
            }
          ],
          "meta": [
            {
              "key": "pa_color",
              "label": "Color",
              "value": "Black"
            }
          ]
        }
      ],
      "tax_lines": [
        {
          "id": 21,
          "rate_code": "US-CA-STATE TAX",
          "rate_id": "75",
          "label": "State Tax",
          "compound": false,
          "tax_total": "1.95",
          "shipping_tax_total": "0.00"
        }
      ],
      "shipping_lines": [
        {
          "id": 20,
          "method_title": "Flat Rate",
          "method_id": "flat_rate",
          "total": "10.00",
          "total_tax": "0.00",
          "taxes": []
        }
      ],
      "fee_lines": [],
      "coupon_lines": [],
      "refunds": [],
      "_links": {
        "self": [
          {
            "href": "https://example.com/wp-json/wc/v1/orders/154"
          }
        ],
        "collection": [
          {
            "href": "https://example.com/wp-json/wc/v1/orders"
          }
        ]
      }
    }
  ]
}