wordpress之woocommer手册---orders订单篇

Orders

This section lists all API that can be used to create, edit or otherwise manipulate orders.

Orders Properties

AttributeTypeDescription
idintegerOrder ID (post ID) read-only
order_numberintegerOrder number read-only
created_atstringUTC DateTime when the order was created read-only
updated_atstringUTC DateTime when the order was last updated read-only
completed_atstringUTC DateTime when the order was last completed read-only
statusstringOrder status. By default are available the status: pending, processing, on-hold, completed, cancelled, refunded and failed. See View List of Order Statuses
currencystringCurrency in ISO format, e.g USD
totalfloatOrder total read-only
subtotalfloatOrder subtotal read-only
total_line_items_quantityintegerTotal of order items read-only
total_taxfloatOrder tax total read-only
total_shippingfloatOrder shipping total read-only
cart_taxfloatOrder cart tax read-only
shipping_taxfloatOrder shipping tax read-only
total_discountfloatOrder total discount read-only
shipping_methodsstringText list of the shipping methods used in the order read-only
payment_detailsarrayList of payment details. See Payment Details Properties
billing_addressarrayList of customer billing address. See Customer Billing Address Properties
shipping_addressarrayList of customer shipping address. See Customer Shipping Address Properties
notestringCustomer order notes
customer_ipstringCustomer IP address read-only
customer_user_agentstringCustomer User-Agent read-only
customer_idintegerCustomer ID (user ID) required
view_order_urlstringURL to view the order in frontend read-only
line_itemsarrayList of order line items. See Line Items Properties
shipping_linesarrayList of shipping line items. See Shipping Lines Properties
tax_linesarrayList of tax line items. See Tax Lines Properties read-only
fee_linesarrayList of fee line items. See Fee Lines Properites
coupon_linesarrayList of cupon line items. See Coupon Lines Properties
customerarrayCustomer data. See Customer Properties

Payment Details Properties

AttributeTypeDescription
method_idstringPayment method ID required
method_titlestringPayment method title required
paidbooleanShows/define if the order is paid using this payment method. Use true to complate the payment.
transaction_idstringTransaction ID, an optional field to set the transacion ID when complate one payment (to set this you need set the paid as true too)

Line Items Properties

AttributeTypeDescription
idintegerLine item ID read-only
subtotalfloatLine item subtotal
subtotal_taxfloatLine item tax subtotal
totalfloatLine item total
total_taxfloatLine item tax total
pricefloatProduct price read-only
quantityintegerQuantity
tax_classstringProduct tax class read-only
namestringProduct name read-only
product_idintegerProduct ID required
skustringProduct SKU read-only
metaarrayList of product meta items. See Products Meta Items Properties
variationsarrayList of product variation attributes. e.g: "variation": {"pa_color": "Black", "pa_size": "XGG"} (Use pa_ prefix when is a product attribute) write-only

Products Meta Items Properties

AttributeTypeDescription
keystringMeta item key
labelstringMeta item label
valuestringMeta item value

Shipping Lines Properties

AttributeTypeDescription
idintegerShipping line ID read-only
method_idstringShipping method ID required
method_titlestringShipping method title required
totalfloatTotal amount

Tax Lines Properties

AttributeTypeDescription
idintegerTax rate line ID read-only
rate_idintegerTax rate ID read-only
codestringTax rate code read-only
titlestringTax rate title/name read-only
totalfloatTax rate total read-only
compoundbooleanShows if is or not a compound rate. Compound tax rates are applied on top of other tax rates. read-only

Fee Lines Properites

AttributeTypeDescription
idintegerFee line ID read-only
titlestringShipping method title required
taxablebooleanShows/define if the fee is taxable write-only
tax_classstringTax class, requered in write-mode if the fee is taxable
totalfloatTotal amount
total_taxfloatTax total

Coupon Lines Properties

AttributeTypeDescription
idintegerCoupon line ID read-only
codestringCoupon code required
amountfloatTotal amount required

Create An Order

This API helps you to create a new order.

HTTP Request

POST
/wc-api/v3/orders

Example of create a paid order:

curl -X POST https://example.com/wc-api/v3/orders \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
  "order": {
    "payment_details": {
      "method_id": "bacs",
      "method_title": "Direct Bank Transfer",
      "paid": true
    },
    "billing_address": {
      "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_address": {
      "first_name": "John",
      "last_name": "Doe",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US"
    },
    "customer_id": 2,
    "line_items": [
      {
        "product_id": 546,
        "quantity": 2
      },
      {
        "product_id": 613,
        "quantity": 1,
        "variations": {
          "pa_color": "Black"
        }
      }
    ],
    "shipping_lines": [
      {
        "method_id": "flat_rate",
        "method_title": "Flat Rate",
        "total": 10
      }
    ]
  }
}'
var data = {
  order: {
    payment_details: {
      method_id: 'bacs',
      method_title: 'Direct Bank Transfer',
      paid: true
    },
    billing_address: {
      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_address: {
      first_name: 'John',
      last_name: 'Doe',
      address_1: '969 Market',
      address_2: '',
      city: 'San Francisco',
      state: 'CA',
      postcode: '94103',
      country: 'US'
    },
    customer_id: 2,
    line_items: [
      {
        product_id: 546,
        quantity: 2
      },
      {
        product_id: 613,
        quantity: 1,
        variations: {
          pa_color: 'Black'
        }
      }
    ],
    shipping_lines: [
      {
        method_id: 'flat_rate',
        method_title: 'Flat Rate',
        total: 10
      }
    ]
  }
};

WooCommerce.post('orders', data, function(err, data, res) {
  console.log(res);
});
data = {
    "order": {
        "payment_details": {
            "method_id": "bacs",
            "method_title": "Direct Bank Transfer",
            "paid": True
        },
        "billing_address": {
            "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_address": {
            "first_name": "John",
            "last_name": "Doe",
            "address_1": "969 Market",
            "address_2": "",
            "city": "San Francisco",
            "state": "CA",
            "postcode": "94103",
            "country": "US"
        },
        "customer_id": 2,
        "line_items": [
            {
                "product_id": 546,
                "quantity": 2
            },
            {
                "product_id": 613,
                "quantity": 1,
                "variations": {
                    "pa_color": "Black"
                }
            }
        ],
        "shipping_lines": [
            {
                "method_id": "flat_rate",
                "method_title": "Flat Rate",
                "total": 10
            }
        ]
    }
}

print(wcapi.post("orders", data).json())
data = {
  order: {
    payment_details: {
      method_id: "bacs",
      method_title: "Direct Bank Transfer",
      paid: true
    },
    billing_address: {
      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_address: {
      first_name: "John",
      last_name: "Doe",
      address_1: "969 Market",
      address_2: "",
      city: "San Francisco",
      state: "CA",
      postcode: "94103",
      country: "US"
    },
    customer_id: 2,
    line_items: [
        {
          product_id: 546,
          quantity: 2
        },
        {
          product_id: 613,
          quantity: 1,
          variations: {
            pa_color: "Black"
          }
        }
    ],
    shipping_lines: [
        {
          method_id: "flat_rate",
          method_title: "Flat Rate",
          total: 10
        }
    ]
  }
}

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

JSON response example:

{
  "order": {
    "id": 645,
    "order_number": 645,
    "created_at": "2015-01-26T20:00:21Z",
    "updated_at": "2015-01-26T20:00:21Z",
    "completed_at": "2015-01-26T20:00:21Z",
    "status": "processing",
    "currency": "USD",
    "total": "79.87",
    "subtotal": "63.97",
    "total_line_items_quantity": 3,
    "total_tax": "5.90",
    "total_shipping": "10.00",
    "cart_tax": "5.40",
    "shipping_tax": "0.50",
    "total_discount": "0.00",
    "shipping_methods": "Flat Rate",
    "payment_details": {
      "method_id": "bacs",
      "method_title": "Direct Bank Transfer",
      "paid": true
    },
    "billing_address": {
      "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_address": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US"
    },
    "note": "",
    "customer_ip": "127.0.0.1",
    "customer_user_agent": "WordPress/4.1; http://example.com",
    "customer_id": 2,
    "view_order_url": "https://example.com/my-account/view-order/645",
    "line_items": [
      {
        "id": 504,
        "subtotal": "43.98",
        "subtotal_tax": "4.40",
        "total": "43.98",
        "total_tax": "4.40",
        "price": "21.99",
        "quantity": 2,
        "tax_class": "reduced-rate",
        "name": "Premium Quality",
        "product_id": 546,
        "sku": "",
        "meta": []
      },
      {
        "id": 505,
        "subtotal": "19.99",
        "subtotal_tax": "1.00",
        "total": "19.99",
        "total_tax": "1.00",
        "price": "19.99",
        "quantity": 1,
        "tax_class": null,
        "name": "Ship Your Idea",
        "product_id": 613,
        "sku": "",
        "meta": [
          {
            "key": "pa_color",
            "label": "Color",
            "value": "Black"
          }
        ]
      }
    ],
    "shipping_lines": [
      {
        "id": 506,
        "method_id": "flat_rate",
        "method_title": "Flat Rate",
        "total": "10.00"
      }
    ],
    "tax_lines": [
      {
        "id": 507,
        "rate_id": "5",
        "code": "US-CA-TAX-1",
        "title": "Tax",
        "total": "4.40",
        "compound": false
      },
      {
        "id": 508,
        "rate_id": "4",
        "code": "US-STANDARD-1",
        "title": "Standard",
        "total": "1.50",
        "compound": false
      }
    ],
    "fee_lines": [],
    "coupon_lines": [],
    "customer": {
      "id": 2,
      "created_at": "2014-11-19T18:34:19Z",
      "email": "john.doe@example.com",
      "first_name": "",
      "last_name": "",
      "username": "john.doe",
      "last_order_id": "645",
      "last_order_date": "2015-01-26T20:00:21Z",
      "orders_count": 2,
      "total_spent": "19.00",
      "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
      "billing_address": {
        "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_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      }
    }
  }
}

View An Order

This API lets you retrieve and view a specific order.

HTTP Request

GET
/wc-api/v3/orders/<id>
curl https://example.com/wc-api/v3/orders/645 \
	-u consumer_key:consumer_secret
WooCommerce.get('orders/645', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("orders/645").json())
woocommerce.get("orders/645").parsed_response

JSON response example:

{
  "order": {
    "id": 645,
    "order_number": 645,
    "created_at": "2015-01-26T20:00:21Z",
    "updated_at": "2015-01-26T20:00:21Z",
    "completed_at": "2015-01-26T20:00:21Z",
    "status": "processing",
    "currency": "USD",
    "total": "79.87",
    "subtotal": "63.97",
    "total_line_items_quantity": 3,
    "total_tax": "5.90",
    "total_shipping": "10.00",
    "cart_tax": "5.40",
    "shipping_tax": "0.50",
    "total_discount": "0.00",
    "shipping_methods": "Flat Rate",
    "payment_details": {
      "method_id": "bacs",
      "method_title": "Direct Bank Transfer",
      "paid": true
    },
    "billing_address": {
      "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_address": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US"
    },
    "note": "",
    "customer_ip": "127.0.0.1",
    "customer_user_agent": "WordPress/4.1; http://example.com",
    "customer_id": 2,
    "view_order_url": "https://example.com/my-account/view-order/645",
    "line_items": [
      {
        "id": 504,
        "subtotal": "43.98",
        "subtotal_tax": "4.40",
        "total": "43.98",
        "total_tax": "4.40",
        "price": "21.99",
        "quantity": 2,
        "tax_class": "reduced-rate",
        "name": "Premium Quality",
        "product_id": 546,
        "sku": "",
        "meta": []
      },
      {
        "id": 505,
        "subtotal": "19.99",
        "subtotal_tax": "1.00",
        "total": "19.99",
        "total_tax": "1.00",
        "price": "19.99",
        "quantity": 1,
        "tax_class": null,
        "name": "Ship Your Idea",
        "product_id": 613,
        "sku": "",
        "meta": [
          {
            "key": "pa_color",
            "label": "Color",
            "value": "Black"
          }
        ]
      }
    ],
    "shipping_lines": [
      {
        "id": 506,
        "method_id": "flat_rate",
        "method_title": "Flat Rate",
        "total": "10.00"
      }
    ],
    "tax_lines": [
      {
        "id": 507,
        "rate_id": "5",
        "code": "US-CA-TAX-1",
        "title": "Tax",
        "total": "4.40",
        "compound": false
      },
      {
        "id": 508,
        "rate_id": "4",
        "code": "US-STANDARD-1",
        "title": "Standard",
        "total": "1.50",
        "compound": false
      }
    ],
    "fee_lines": [],
    "coupon_lines": [],
    "customer": {
      "id": 2,
      "created_at": "2014-11-19T18:34:19Z",
      "email": "john.doe@example.com",
      "first_name": "",
      "last_name": "",
      "username": "john.doe",
      "last_order_id": "645",
      "last_order_date": "2015-01-26T20:00:21Z",
      "orders_count": 2,
      "total_spent": "19.00",
      "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
      "billing_address": {
        "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_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      }
    }
  }
}

View List Of Orders

This API helps you to view all the orders.

HTTP Request

GET
/wc-api/v3/orders
curl https://example.com/wc-api/v3/orders \
	-u consumer_key:consumer_secret
WooCommerce.get('orders', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("orders").json())
woocommerce.get("orders").parsed_response

JSON response example:

{
  "orders": [
    {
      "id": 645,
      "order_number": 645,
      "created_at": "2015-01-26T20:00:21Z",
      "updated_at": "2015-01-26T20:00:21Z",
      "completed_at": "2015-01-26T20:00:21Z",
      "status": "processing",
      "currency": "USD",
      "total": "79.87",
      "subtotal": "63.97",
      "total_line_items_quantity": 3,
      "total_tax": "5.90",
      "total_shipping": "10.00",
      "cart_tax": "5.40",
      "shipping_tax": "0.50",
      "total_discount": "0.00",
      "shipping_methods": "Flat Rate",
      "payment_details": {
        "method_id": "bacs",
        "method_title": "Direct Bank Transfer",
        "paid": true
      },
      "billing_address": {
        "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_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      },
      "note": "",
      "customer_ip": "127.0.0.1",
      "customer_user_agent": "WordPress/4.1; http://example.com",
      "customer_id": 2,
      "view_order_url": "https://example.com/my-account/view-order/645",
      "line_items": [
        {
          "id": 504,
          "subtotal": "43.98",
          "subtotal_tax": "4.40",
          "total": "43.98",
          "total_tax": "4.40",
          "price": "21.99",
          "quantity": 2,
          "tax_class": "reduced-rate",
          "name": "Premium Quality",
          "product_id": 546,
          "sku": "",
          "meta": []
        },
        {
          "id": 505,
          "subtotal": "19.99",
          "subtotal_tax": "1.00",
          "total": "19.99",
          "total_tax": "1.00",
          "price": "19.99",
          "quantity": 1,
          "tax_class": null,
          "name": "Ship Your Idea",
          "product_id": 613,
          "sku": "",
          "meta": [
            {
              "key": "pa_color",
              "label": "Color",
              "value": "Black"
            }
          ]
        }
      ],
      "shipping_lines": [
        {
          "id": 506,
          "method_id": "flat_rate",
          "method_title": "Flat Rate",
          "total": "10.00"
        }
      ],
      "tax_lines": [
        {
          "id": 507,
          "rate_id": "5",
          "code": "US-CA-TAX-1",
          "title": "Tax",
          "total": "4.40",
          "compound": false
        },
        {
          "id": 508,
          "rate_id": "4",
          "code": "US-STANDARD-1",
          "title": "Standard",
          "total": "1.50",
          "compound": false
        }
      ],
      "fee_lines": [],
      "coupon_lines": [],
      "customer": {
        "id": 2,
        "created_at": "2014-11-19T18:34:19Z",
        "email": "john.doe@example.com",
        "first_name": "",
        "last_name": "",
        "username": "john.doe",
        "last_order_id": "645",
        "last_order_date": "2015-01-26T20:00:21Z",
        "orders_count": 2,
        "total_spent": "19.00",
        "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
        "billing_address": {
          "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_address": {
          "first_name": "John",
          "last_name": "Doe",
          "company": "",
          "address_1": "969 Market",
          "address_2": "",
          "city": "San Francisco",
          "state": "CA",
          "postcode": "94103",
          "country": "US"
        }
      }
    },
    {
      "id": 644,
      "order_number": 644,
      "created_at": "2015-01-26T19:33:42Z",
      "updated_at": "2015-01-26T19:33:42Z",
      "completed_at": "2015-01-26T19:33:42Z",
      "status": "on-hold",
      "currency": "USD",
      "total": "44.14",
      "subtotal": "30.99",
      "total_line_items_quantity": 2,
      "total_tax": "3.15",
      "total_shipping": "10.00",
      "cart_tax": "2.65",
      "shipping_tax": "0.50",
      "total_discount": "0.00",
      "shipping_methods": "Flat Rate",
      "payment_details": {
        "method_id": "bacs",
        "method_title": "Direct Bank Transfer",
        "paid": false
      },
      "billing_address": {
        "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_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      },
      "note": "",
      "customer_ip": "127.0.0.1",
      "customer_user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.91 Safari/537.36",
      "customer_id": 2,
      "view_order_url": "https://example.com/my-account/view-order/644",
      "line_items": [
        {
          "id": 499,
          "subtotal": "21.99",
          "subtotal_tax": "2.20",
          "total": "21.99",
          "total_tax": "2.20",
          "price": "21.99",
          "quantity": 1,
          "tax_class": "reduced-rate",
          "name": "Premium Quality",
          "product_id": 546,
          "sku": "",
          "meta": []
        },
        {
          "id": 500,
          "subtotal": "9.00",
          "subtotal_tax": "0.45",
          "total": "9.00",
          "total_tax": "0.45",
          "price": "9.00",
          "quantity": 1,
          "tax_class": null,
          "name": "Woo Album #4",
          "product_id": 96,
          "sku": "",
          "meta": []
        }
      ],
      "shipping_lines": [
        {
          "id": 501,
          "method_id": "flat_rate",
          "method_title": "Flat Rate",
          "total": "10.00"
        }
      ],
      "tax_lines": [
        {
          "id": 502,
          "rate_id": "5",
          "code": "US-CA-TAX-1",
          "title": "Tax",
          "total": "4.40",
          "compound": false
        },
        {
          "id": 503,
          "rate_id": "4",
          "code": "US-STANDARD-1",
          "title": "Standard",
          "total": "1.50",
          "compound": false
        }
      ],
      "fee_lines": [],
      "coupon_lines": [],
      "customer": {
        "id": 2,
        "created_at": "2014-11-19T18:34:19Z",
        "email": "john.doe@example.com",
        "first_name": "",
        "last_name": "",
        "username": "john.doe",
        "last_order_id": "645",
        "last_order_date": "2015-01-26T20:00:21Z",
        "orders_count": 2,
        "total_spent": "19.00",
        "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
        "billing_address": {
          "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_address": {
          "first_name": "John",
          "last_name": "Doe",
          "company": "",
          "address_1": "969 Market",
          "address_2": "",
          "city": "San Francisco",
          "state": "CA",
          "postcode": "94103",
          "country": "US"
        }
      }
    }
  ]
}

Available Filters

FilterTypeDescription
statusstringOrders by status. eg: processing or cancelled

Update An Order

This API lets you make changes to an order.

HTTP Request

PUT
/wc-api/v3/orders/<id>
curl -X PUT https://example.com/wc-api/v3/orders/645 \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
  "order": {
    "status": "completed"
  }
}'
var data = {
  order: {
    status: 'completed'
  }
};

WooCommerce.put('orders/645', data, function(err, data, res) {
  console.log(res);
});
data = {
    "order": {
        "status": "completed"
    }
}

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

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

JSON response example:

{
  "order": {
    "id": 645,
    "order_number": 645,
    "created_at": "2015-01-26T20:00:21Z",
    "updated_at": "2015-01-26T20:00:21Z",
    "completed_at": "2015-01-26T20:00:21Z",
    "status": "completed",
    "currency": "USD",
    "total": "79.87",
    "subtotal": "63.97",
    "total_line_items_quantity": 3,
    "total_tax": "5.90",
    "total_shipping": "10.00",
    "cart_tax": "5.40",
    "shipping_tax": "0.50",
    "total_discount": "0.00",
    "shipping_methods": "Flat Rate",
    "payment_details": {
      "method_id": "bacs",
      "method_title": "Direct Bank Transfer",
      "paid": true
    },
    "billing_address": {
      "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_address": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US"
    },
    "note": "",
    "customer_ip": "127.0.0.1",
    "customer_user_agent": "WordPress/4.1; http://example.com",
    "customer_id": 2,
    "view_order_url": "https://example.com/my-account/view-order/645",
    "line_items": [
      {
        "id": 504,
        "subtotal": "43.98",
        "subtotal_tax": "4.40",
        "total": "43.98",
        "total_tax": "4.40",
        "price": "21.99",
        "quantity": 2,
        "tax_class": "reduced-rate",
        "name": "Premium Quality",
        "product_id": 546,
        "sku": "",
        "meta": []
      },
      {
        "id": 505,
        "subtotal": "19.99",
        "subtotal_tax": "1.00",
        "total": "19.99",
        "total_tax": "1.00",
        "price": "19.99",
        "quantity": 1,
        "tax_class": null,
        "name": "Ship Your Idea",
        "product_id": 613,
        "sku": "",
        "meta": [
          {
            "key": "pa_color",
            "label": "Color",
            "value": "Black"
          }
        ]
      }
    ],
    "shipping_lines": [
      {
        "id": 506,
        "method_id": "flat_rate",
        "method_title": "Flat Rate",
        "total": "10.00"
      }
    ],
    "tax_lines": [
      {
        "id": 507,
        "rate_id": "5",
        "code": "US-CA-TAX-1",
        "title": "Tax",
        "total": "4.40",
        "compound": false
      },
      {
        "id": 508,
        "rate_id": "4",
        "code": "US-STANDARD-1",
        "title": "Standard",
        "total": "1.50",
        "compound": false
      }
    ],
    "fee_lines": [],
    "coupon_lines": [],
    "customer": {
      "id": 2,
      "created_at": "2014-11-19T18:34:19Z",
      "email": "john.doe@example.com",
      "first_name": "",
      "last_name": "",
      "username": "john.doe",
      "last_order_id": "645",
      "last_order_date": "2015-01-26T20:00:21Z",
      "orders_count": 2,
      "total_spent": "19.00",
      "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
      "billing_address": {
        "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_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      }
    }
  }
}

Create/Update Multiple Orders

This API helps you to bulk create/update multiple orders.

To update is necessary to send objects containing IDs and to create new not just send the ID.

HTTP Request

POST
/wc-api/v3/orders/bulk
curl -X PUT https://example.com/wc-api/v3/orders/bulk \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
  "orders": [
    {
      "id": 645,
      "shipping_methods": "Local Delivery"
    },
    {
      "id": 644,
      "shipping_methods": "Local Delivery"
    }
  ]
}'
var data = {
  orders: [
    {
      id: 645,
      shipping_methods: "Local Delivery"
    },
    {
      id: 644,
      shipping_methods: "Local Delivery"
    }
  ]
};

WooCommerce.put('orders/bulk', data, function(err, data, res) {
  console.log(res);
});
data = {
    "orders": [
        {
            "id": 645,
            "shipping_methods": "Local Delivery"
        },
        {
            "id": 644,
            "shipping_methods": "Local Delivery"
        }
    ]
}

print(wcapi.put("orders/bulk", data).json())
data = {
  orders: [
    {
      id: 645,
      shipping_methods: "Local Delivery"
    },
    {
      id: 644,
      shipping_methods: "Local Delivery"
    }
  ]
}

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

JSON response example:

{
  "orders": [
    {
      "id": 645,
      "order_number": 645,
      "created_at": "2015-01-26T20:00:21Z",
      "updated_at": "2015-07-31T11:45:12Z",
      "completed_at": "2015-01-26T20:00:21Z",
      "status": "processing",
      "currency": "USD",
      "total": "79.87",
      "subtotal": "63.97",
      "total_line_items_quantity": 3,
      "total_tax": "5.90",
      "total_shipping": "10.00",
      "cart_tax": "5.40",
      "shipping_tax": "0.50",
      "total_discount": "0.00",
      "shipping_methods": "Local Delivery",
      "payment_details": {
        "method_id": "bacs",
        "method_title": "Direct Bank Transfer",
        "paid": true
      },
      "billing_address": {
        "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_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      },
      "note": "",
      "customer_ip": "127.0.0.1",
      "customer_user_agent": "WordPress/4.1; http://example.com",
      "customer_id": 2,
      "view_order_url": "https://example.com/my-account/view-order/645",
      "line_items": [
        {
          "id": 504,
          "subtotal": "43.98",
          "subtotal_tax": "4.40",
          "total": "43.98",
          "total_tax": "4.40",
          "price": "21.99",
          "quantity": 2,
          "tax_class": "reduced-rate",
          "name": "Premium Quality",
          "product_id": 546,
          "sku": "",
          "meta": []
        },
        {
          "id": 505,
          "subtotal": "19.99",
          "subtotal_tax": "1.00",
          "total": "19.99",
          "total_tax": "1.00",
          "price": "19.99",
          "quantity": 1,
          "tax_class": null,
          "name": "Ship Your Idea",
          "product_id": 613,
          "sku": "",
          "meta": [
            {
              "key": "pa_color",
              "label": "Color",
              "value": "Black"
            }
          ]
        }
      ],
      "shipping_lines": [
        {
          "id": 506,
          "method_id": "flat_rate",
          "method_title": "Local Delivery",
          "total": "10.00"
        }
      ],
      "tax_lines": [
        {
          "id": 507,
          "rate_id": "5",
          "code": "US-CA-TAX-1",
          "title": "Tax",
          "total": "4.40",
          "compound": false
        },
        {
          "id": 508,
          "rate_id": "4",
          "code": "US-STANDARD-1",
          "title": "Standard",
          "total": "1.50",
          "compound": false
        }
      ],
      "fee_lines": [],
      "coupon_lines": [],
      "customer": {
        "id": 2,
        "created_at": "2014-11-19T18:34:19Z",
        "email": "john.doe@example.com",
        "first_name": "",
        "last_name": "",
        "username": "john.doe",
        "last_order_id": "645",
        "last_order_date": "2015-01-26T20:00:21Z",
        "orders_count": 2,
        "total_spent": "19.00",
        "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
        "billing_address": {
          "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_address": {
          "first_name": "John",
          "last_name": "Doe",
          "company": "",
          "address_1": "969 Market",
          "address_2": "",
          "city": "San Francisco",
          "state": "CA",
          "postcode": "94103",
          "country": "US"
        }
      }
    },
    {
      "id": 644,
      "order_number": 644,
      "created_at": "2015-01-26T19:33:42Z",
      "updated_at": "2015-07-31T11:45:12Z",
      "completed_at": "2015-01-26T19:33:42Z",
      "status": "on-hold",
      "currency": "USD",
      "total": "44.14",
      "subtotal": "30.99",
      "total_line_items_quantity": 2,
      "total_tax": "3.15",
      "total_shipping": "10.00",
      "cart_tax": "2.65",
      "shipping_tax": "0.50",
      "total_discount": "0.00",
      "shipping_methods": "Flat Rate",
      "payment_details": {
        "method_id": "bacs",
        "method_title": "Direct Bank Transfer",
        "paid": false
      },
      "billing_address": {
        "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_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      },
      "note": "",
      "customer_ip": "127.0.0.1",
      "customer_user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.91 Safari/537.36",
      "customer_id": 2,
      "view_order_url": "https://example.com/my-account/view-order/644",
      "line_items": [
        {
          "id": 499,
          "subtotal": "21.99",
          "subtotal_tax": "2.20",
          "total": "21.99",
          "total_tax": "2.20",
          "price": "21.99",
          "quantity": 1,
          "tax_class": "reduced-rate",
          "name": "Premium Quality",
          "product_id": 546,
          "sku": "",
          "meta": []
        },
        {
          "id": 500,
          "subtotal": "9.00",
          "subtotal_tax": "0.45",
          "total": "9.00",
          "total_tax": "0.45",
          "price": "9.00",
          "quantity": 1,
          "tax_class": null,
          "name": "Woo Album #4",
          "product_id": 96,
          "sku": "",
          "meta": []
        }
      ],
      "shipping_lines": [
        {
          "id": 501,
          "method_id": "flat_rate",
          "method_title": "Flat Rate",
          "total": "10.00"
        }
      ],
      "tax_lines": [
        {
          "id": 502,
          "rate_id": "5",
          "code": "US-CA-TAX-1",
          "title": "Tax",
          "total": "4.40",
          "compound": false
        },
        {
          "id": 503,
          "rate_id": "4",
          "code": "US-STANDARD-1",
          "title": "Standard",
          "total": "1.50",
          "compound": false
        }
      ],
      "fee_lines": [],
      "coupon_lines": [],
      "customer": {
        "id": 2,
        "created_at": "2014-11-19T18:34:19Z",
        "email": "john.doe@example.com",
        "first_name": "",
        "last_name": "",
        "username": "john.doe",
        "last_order_id": "645",
        "last_order_date": "2015-01-26T20:00:21Z",
        "orders_count": 2,
        "total_spent": "19.00",
        "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
        "billing_address": {
          "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_address": {
          "first_name": "John",
          "last_name": "Doe",
          "company": "",
          "address_1": "969 Market",
          "address_2": "",
          "city": "San Francisco",
          "state": "CA",
          "postcode": "94103",
          "country": "US"
        }
      }
    }
  ]
}

Delete An Order

This API helps you delete an order.

HTTP Request

DELETE
/wc-api/v3/orders/<id>
curl -X DELETE https://example.com/wc-api/v3/orders/645/?force=true \
	-u consumer_key:consumer_secret
WooCommerce.delete('orders/645/?force=true', function(err, data, res) {
  console.log(res);
});
print(wcapi.delete("orders/645/?force=true").json())
woocommerce.delete("orders/645/?force=true").parsed_response

JSON response example:

{
  "message": "Permanently deleted order"
}

Parameters

ParameterTypeDescription
forcestringUse true whether to permanently delete the order, defaults to false. Note that permanently deleting the order will return HTTP 200 rather than HTTP 202.

View Orders Count

This API lets you retrieve a count of all orders.

HTTP Request

GET
/wc-api/v3/orders/count
curl https://example.com/wc-api/v3/orders/count \
	-u consumer_key:consumer_secret
WooCommerce.get('orders/count', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("orders/count").json())
woocommerce.get("orders/count").parsed_response

JSON response example:

{
  "count": 2
}

Available Filters

FilterTypeDescription
statusstringOrders by status. eg: processing or cancelled

View List Of Order Statuses

This API lets you retrieve a list of orders statuses available.

HTTP Request

GET
/wc-api/v3/orders/statuses
curl https://example.com/wc-api/v3/orders/statuses \
	-u consumer_key:consumer_secret
WooCommerce.get('orders/statuses', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("orders/statuses").json())
woocommerce.get("orders/statuses").parsed_response

JSON response example:

{
  "order_statuses": {
    "pending": "Pending Payment",
    "processing": "Processing",
    "on-hold": "On Hold",
    "completed": "Completed",
    "cancelled": "Cancelled",
    "refunded": "Refunded",
    "failed": "Failed"
  }
}

Create A Note For An Order

This API helps you to create a new note for an order.

HTTP Request

POST
/wc-api/v3/orders/<id>/notes
curl -X POST https://example.com/wc-api/v3/orders/645/notes \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
  "order_note": {
    "note": "Order ok!!!"
  }
}'
var data = {
  order_note: {
    note: 'Order ok!!!'
  }
};

WooCommerce.post('orders/645/notes', data, function(err, data, res) {
  console.log(res);
});
data = {
    "order_note": {
        "note": "Order ok!!!"
    }
}

print(wcapi.post("orders/645/notes", data).json())
data = {
  order_note: {
    note: "Order ok!!!"
  }
}

woocommerce.post("orders/645/notes", data).parsed_response

JSON response example:

{
  "order_note": {
    "id": "416",
    "created_at": "2015-01-26T20:56:44Z",
    "note": "Order ok!!!",
    "customer_note": false
  }
}

Order Notes Properties

AttributeTypeDescription
idintegerOrder note ID read-only
created_atstringUTC DateTime when the order note was created read-only
notestringOrder note required
customer_notebooleanShows/define if the note is only for reference or for the customer (the user will be notified). Default is false

View An Order Note

This API lets you retrieve and view a specific note from an order.

HTTP Request

GET
/wc-api/v3/orders/<id>/notes/<note_id>
curl https://example.com/wc-api/v3/orders/645/notes/416 \
	-u consumer_key:consumer_secret
WooCommerce.get('orders/645/notes/416', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("orders/645/notes/416").json())
woocommerce.get("orders/645/notes/416").parsed_response

JSON response example:

{
  "order_note": {
    "id": "416",
    "created_at": "2015-01-26T20:56:44Z",
    "note": "Order ok!!!",
    "customer_note": false
  }
}

View List Of Notes From An Order

This API helps you to view all the notes from an order.

HTTP Request

GET
/wc-api/v3/orders/<id>/notes
curl https://example.com/wc-api/v3/orders/645/notes \
	-u consumer_key:consumer_secret
WooCommerce.get('orders/645/notes', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("orders/645/notes").json())
woocommerce.get("orders/645/notes").parsed_response

JSON response example:

{
  "order_notes": [
    {
      "id": "416",
      "created_at": "2015-01-26T20:56:44Z",
      "note": "Order ok!!!",
      "customer_note": false
    },
    {
      "id": "415",
      "created_at": "2015-01-26T20:16:14Z",
      "note": "Order status changed from Processing to Completed.",
      "customer_note": false
    },
    {
      "id": "412",
      "created_at": "2015-01-26T20:00:21Z",
      "note": "Order item stock reduced successfully.",
      "customer_note": false
    },
    {
      "id": "411",
      "created_at": "2015-01-26T20:00:09Z",
      "note": "Order status changed from Pending Payment to Processing.",
      "customer_note": false
    }
  ]
}

Update An Order Note

This API lets you make changes to an order note.

HTTP Request

PUT
/wc-api/v3/orders/<id>/notes/<note_id>
curl -X PUT https://example.com/wc-api/v3/orders/645/notes/416 \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
  "order_note": {
    "note": "Ok!"
  }
}'
var data = {
  order_note: {
    note: 'Ok!'
  }
};

WooCommerce.put('orders/645/notes/416', data, function(err, data, res) {
  console.log(res);
});
data = {
    "order_note": {
        "note": "Ok!"
    }
}

print(wcapi.put("orders/645/notes/416", data).json())
data = {
  order_note: {
    note: "Ok!"
  }
}

woocommerce.put("orders/645/notes/416", data).parsed_response

JSON response example:

{
  "order_note": {
    "id": "416",
    "created_at": "2015-01-26T20:56:44Z",
    "note": "Ok!",
    "customer_note": false
  }
}

Delete An Order Note

This API helps you delete an order note.

HTTP Request

DELETE
/wc-api/v3/orders/<id>/notes/<note_id>
curl -X DELETE https://example.com/wc-api/v3/orders/645/notes/416 \
	-u consumer_key:consumer_secret
WooCommerce.delete('orders/645/notes/416', function(err, data, res) {
  console.log(res);
});
print(wcapi.delete("orders/645/notes/416").json())
woocommerce.delete("orders/645/notes/416").parsed_response

JSON response example:

{
  "message": "Permanently deleted order note"
}

Create A Refund For An Order

This API helps you to create a new refund for an order.

HTTP Request

POST
/wc-api/v3/orders/<id>/refunds
curl -X POST https://example.com/wc-api/v3/orders/645/refunds \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
  "order_refund": {
    "amount": 10
  }
}'
var data = {
  order_refund: {
    amount: 10
  }
};

WooCommerce.post('orders/645/refunds', data, function(err, data, res) {
  console.log(res);
});
data = {
    "order_refund": {
        "amount": 10
    }
}

print(wcapi.post("orders/645/refunds", data).json())
data = {
  order_refund: {
    amount: 10
  }
}

woocommerce.post("orders/645/refunds", data).parsed_response

JSON response example:

{
  "order_refund": {
    "id": 649,
    "created_at": "2015-01-26T19:29:32Z",
    "amount": "10.00",
    "reason": "",
    "line_items": []
  }
}

Order Refunds Properties

AttributeTypeDescription
idintegerOrder note ID read-only
created_atstringUTC DateTime when the order refund was created read-only
amountfloatRefund amount required
reasonstringReason for refund
line_itemsarrayList of order items to refund. See Line Items Properties

View An Order Refund

This API lets you retrieve and view a specific refund from an order.

HTTP Request

GET
/wc-api/v3/orders/<id>/refunds/<refund_id>
curl https://example.com/wc-api/v3/orders/645/refunds/649 \
	-u consumer_key:consumer_secret
WooCommerce.get('orders/645/refunds/649', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("orders/645/refunds/649").json())
woocommerce.get("orders/645/refunds/649").parsed_response

JSON response example:

{
  "order_refund": {
    "id": 649,
    "created_at": "2015-01-26T19:29:32Z",
    "amount": "10.00",
    "reason": "",
    "line_items": []
  }
}

View List Of Refunds From An Order

This API helps you to view all the refunds from an order.

HTTP Request

GET
/wc-api/v3/orders/<id>/refunds
curl https://example.com/wc-api/v3/orders/645/refunds \
	-u consumer_key:consumer_secret
WooCommerce.get('orders/645/refunds', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("orders/645/refunds").json())
woocommerce.get("orders/645/refunds").parsed_response

JSON response example:

{
  "order_refunds": [
    {
      "id": 649,
      "created_at": "2015-01-26T19:29:32Z",
      "amount": "10.00",
      "reason": "",
      "line_items": []
    },
    {
      "id": 647,
      "created_at": "2015-01-26T19:19:06Z",
      "amount": "21.99",
      "reason": "",
      "line_items": [
        {
          "id": 514,
          "subtotal": "-21.99",
          "subtotal_tax": "0.00",
          "total": "-21.99",
          "total_tax": "0.00",
          "price": "-21.99",
          "quantity": 1,
          "tax_class": "reduced-rate",
          "name": "Premium Quality",
          "product_id": 546,
          "sku": "",
          "meta": []
        },
        {
          "id": 515,
          "subtotal": "0.00",
          "subtotal_tax": "0.00",
          "total": "0.00",
          "total_tax": "0.00",
          "price": "0.00",
          "quantity": 0,
          "tax_class": null,
          "name": "Ship Your Idea",
          "product_id": 613,
          "sku": "",
          "meta": []
        }
      ]
    }
  ]
}

Update An Order Refund

This API lets you make changes to an order refund.

HTTP Request

PUT
/wc-api/v3/orders/<id>/refunds/<refund_id>
curl -X PUT https://example.com/wc-api/v3/orders/645/refunds/649 \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
  "order_refund": {
    "reason": "Because was it necessary!"
  }
}'
var data = {
  order_refund: {
    reason: 'Because was it necessary!'
  }
};

WooCommerce.put('orders/645/refunds/649', data, function(err, data, res) {
  console.log(res);
});
data = {
    "order_refund": {
        "reason": "Because was it necessary!"
    }
}

print(wcapi.put("orders/645/refunds/649", data).json())
data = {
  order_refund: {
    reason: "Because was it necessary!"
  }
}

woocommerce.put("orders/645/refunds/649", data).parsed_response

JSON response example:

{
  "order_refund": {
    "id": 649,
    "created_at": "2015-01-26T19:29:32Z",
    "amount": "10.00",
    "reason": "Because was it necessary!",
    "line_items": []
  }
}

Delete An Order Refund

This API helps you delete an order refund.

HTTP Request

DELETE
/wc-api/v3/orders/<id>/refunds/<refund_id>
curl -X DELETE https://example.com/wc-api/v3/orders/645/refunds/649 \
	-u consumer_key:consumer_secret
WooCommerce.delete('orders/645/refunds/649', function(err, data, res) {
  console.log(res);
});
print(wcapi.delete("orders/645/refunds/649").json())
woocommerce.delete("orders/645/refunds/649").parsed_response

JSON response example:

{
  "message": "Permanently deleted refund"
}
posted @ 2022-04-02 09:46  coderwcb  阅读(82)  评论(0)    收藏  举报