# orders_v2

OrdersV2 - JavaScript client for orders_v2
`/orders`endpoints integrate with point-of-sale, shipping, distribution, and inventory-management systems.  ## Order The Order object contains a record of the purchase agreement between a shopper and a merchant. To learn more about creating orders, see [Orders API Guide](/api-docs/orders/orders-api-overview).  ### Currency Fields  * `currency_code` - the display currency used to present prices to the shopper on the storefront. * `currency_exchange_rate`: the exchange rate between the store's default currency and the display currency; when the order is created by means of the V2 endpoints, this value is always 1 (only in the storefront this value can be different to 1).  The following additional fields are returned on orders when Multi-Currency is enabled on the store:  * `store_default_currency_code` - the store's default currency * `store_default_to_transactional_exchange_rate` - the exchange rate between the store's default currency and the transactional currency used in the order.  **Example:**  ```json {   //...   \"currency_id\": 4,   \"currency_code\": \"EUR\",   \"currency_exchange_rate\": 1,   \"default_currency_id\": 4,   \"default_currency_code\": \"EUR\",   \"store_default_currency_code: \"USD\",   \"store_default_to_transactional_exchange_rate\": \"100.0000000000\"   //... }  ```  ## Order Coupons Coupon code applied to an order.  ## Order Messages Messages associated with an order.  ## Order Products Product line items belonging to an order.  ## Order Shipping Addresses Customer shipping address belonging to an order.  ## Order Statuses Each order status represents a state in the order-fulfillment workflow.  ## Order Taxes Each tax applied to an order. This information can be useful for reporting purposes. All values are read-only.  ## Order Shipments Tracks a package consignment from an order that is shipped from the seller to the buyer.  ## Order Shipping Addresses Quotes Read Only. Gets all shipping quotes from an order.
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:

- API version: 2.0
- Package version: 2.0
- Build package: io.swagger.codegen.v3.generators.javascript.JavaScriptClientCodegen

## Installation

### For [Node.js](https://nodejs.org/)

#### npm

To publish the library as a [npm](https://www.npmjs.com/),
please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages).

Then install it via:

```shell
npm install orders_v2 --save
```

#### git
#
If the library is hosted at a git repository, e.g.
https://github.com/GIT_USER_ID/GIT_REPO_ID
then install it via:

```shell
    npm install GIT_USER_ID/GIT_REPO_ID --save
```

### For browser

The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following
the above steps with Node.js and installing browserify with `npm install -g browserify`,
perform the following (assuming *main.js* is your entry file):

```shell
browserify main.js > bundle.js
```

Then include *bundle.js* in the HTML pages.

### Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error:
Cannot resolve module", most certainly you should disable AMD loader. Add/merge
the following section to your webpack config:

```javascript
module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}
```

## Getting Started

Please follow the [installation](#installation) instruction and execute the following JS code:

```javascript
var OrdersV2 = require('orders_v2');
var defaultClient = OrdersV2.ApiClient.instance;

// Configure API key authorization: X-Auth-Client
var X-Auth-Client = defaultClient.authentications['X-Auth-Client'];
X-Auth-Client.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//X-Auth-Client.apiKeyPrefix['X-Auth-Client'] = "Token"

// Configure API key authorization: X-Auth-Token
var X-Auth-Token = defaultClient.authentications['X-Auth-Token'];
X-Auth-Token.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//X-Auth-Token.apiKeyPrefix['X-Auth-Token'] = "Token"

var api = new OrdersV2.OrderCouponsApi()
var orderId = 56; // {Number} ID of the order
var accept = "application/json"; // {String} 
var contentType = "application/json"; // {String} 
var opts = { 
  'page': 1.2, // {Number} The page to return in the response.
  'limit': 1.2 // {Number} Number of results to return.
};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getAllOrderCoupons(orderId, accept, contentType, opts, callback);
```

## Documentation for API Endpoints

All URIs are relative to *https://api.bigcommerce.com/stores/{$$.env.store_hash}/v2*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*OrdersV2.OrderCouponsApi* | [**getAllOrderCoupons**](docs/OrderCouponsApi.md#getAllOrderCoupons) | **GET** /orders/{order_id}/coupons | List Order Coupons
*OrdersV2.OrderMessagesApi* | [**getOrderMessages**](docs/OrderMessagesApi.md#getOrderMessages) | **GET** /orders/{order_id}/messages | Get Order Messages
*OrdersV2.OrderProductsApi* | [**getAllOrderProducts**](docs/OrderProductsApi.md#getAllOrderProducts) | **GET** /orders/{order_id}/products | List Order Products
*OrdersV2.OrderProductsApi* | [**getAnOrderProduct**](docs/OrderProductsApi.md#getAnOrderProduct) | **GET** /orders/{order_id}/products/{id} | Get an Order Product
*OrdersV2.OrderShipmentsApi* | [**createOrderShipments**](docs/OrderShipmentsApi.md#createOrderShipments) | **POST** /orders/{order_id}/shipments | Create Order Shipment
*OrdersV2.OrderShipmentsApi* | [**deleteAllOrderShipments**](docs/OrderShipmentsApi.md#deleteAllOrderShipments) | **DELETE** /orders/{order_id}/shipments | Delete Order Shipments
*OrdersV2.OrderShipmentsApi* | [**deleteOrderShipment**](docs/OrderShipmentsApi.md#deleteOrderShipment) | **DELETE** /orders/{order_id}/shipments/{shipment_id} | Delete an Order Shipment
*OrdersV2.OrderShipmentsApi* | [**getAllOrderShipments**](docs/OrderShipmentsApi.md#getAllOrderShipments) | **GET** /orders/{order_id}/shipments | Get Order Shipments
*OrdersV2.OrderShipmentsApi* | [**getCountShipments**](docs/OrderShipmentsApi.md#getCountShipments) | **GET** /orders/{order_id}/shipments/count | Get Count of Order Shipments
*OrdersV2.OrderShipmentsApi* | [**getOrderShipment**](docs/OrderShipmentsApi.md#getOrderShipment) | **GET** /orders/{order_id}/shipments/{shipment_id} | Get a Shipment
*OrdersV2.OrderShipmentsApi* | [**updateOrderShipment**](docs/OrderShipmentsApi.md#updateOrderShipment) | **PUT** /orders/{order_id}/shipments/{shipment_id} | Update a Shipment
*OrdersV2.OrderShippingAddressesApi* | [**getAShippingAddress**](docs/OrderShippingAddressesApi.md#getAShippingAddress) | **GET** /orders/{order_id}/shipping_addresses/{id} | Get a Shipping Address
*OrdersV2.OrderShippingAddressesApi* | [**getAllShippingAddresses**](docs/OrderShippingAddressesApi.md#getAllShippingAddresses) | **GET** /orders/{order_id}/shipping_addresses | Get Order Shipping Addresses
*OrdersV2.OrderShippingAddressesApi* | [**updateAShippingAddress**](docs/OrderShippingAddressesApi.md#updateAShippingAddress) | **PUT** /orders/{order_id}/shipping_addresses/{id} | Update a Shipping Address
*OrdersV2.OrderShippingAddressesQuotesApi* | [**getShippingQuotes**](docs/OrderShippingAddressesQuotesApi.md#getShippingQuotes) | **GET** /orders/{order_id}/shipping_addresses/{shipping_address_id}/shipping_quotes | Get Order Shipping Quotes
*OrdersV2.OrderStatusApi* | [**getAOrderStatus**](docs/OrderStatusApi.md#getAOrderStatus) | **GET** /order_statuses/{status_id} | Get a Single Order Status by Id
*OrdersV2.OrderStatusApi* | [**getOrderStatus**](docs/OrderStatusApi.md#getOrderStatus) | **GET** /order_statuses | Get All Order Statuses
*OrdersV2.OrderTaxesApi* | [**getOrderTaxes**](docs/OrderTaxesApi.md#getOrderTaxes) | **GET** /orders/{order_id}/taxes | Get All Order Taxes
*OrdersV2.OrdersApi* | [**createAnOrder**](docs/OrdersApi.md#createAnOrder) | **POST** /orders | Create an Order
*OrdersV2.OrdersApi* | [**deleteAllOrders**](docs/OrdersApi.md#deleteAllOrders) | **DELETE** /orders | Delete All Orders
*OrdersV2.OrdersApi* | [**deleteAnOrder**](docs/OrdersApi.md#deleteAnOrder) | **DELETE** /orders/{order_id} | Archive an Order
*OrdersV2.OrdersApi* | [**getAllOrders**](docs/OrdersApi.md#getAllOrders) | **GET** /orders | Get All Orders
*OrdersV2.OrdersApi* | [**getAnOrder**](docs/OrdersApi.md#getAnOrder) | **GET** /orders/{order_id} | Get an Order
*OrdersV2.OrdersApi* | [**getCountOrder**](docs/OrdersApi.md#getCountOrder) | **GET** /orders/count | Get a Count of Orders
*OrdersV2.OrdersApi* | [**updateAnOrder**](docs/OrdersApi.md#updateAnOrder) | **PUT** /orders/{order_id} | Update an Order

## Documentation for Models

 - [OrdersV2.AllOforderBaseBillingAddress](docs/AllOforderBaseBillingAddress.md)
 - [OrdersV2.AllOforderFull1BillingAddress](docs/AllOforderFull1BillingAddress.md)
 - [OrdersV2.AllOforderFull2BillingAddress](docs/AllOforderFull2BillingAddress.md)
 - [OrdersV2.AllOforderFullBillingAddress](docs/AllOforderFullBillingAddress.md)
 - [OrdersV2.AllOfordersCountFull1Statuses](docs/AllOfordersCountFull1Statuses.md)
 - [OrdersV2.AllOfordersCountFullStatuses](docs/AllOfordersCountFullStatuses.md)
 - [OrdersV2.BillingAddressBase](docs/BillingAddressBase.md)
 - [OrdersV2.BillingAddressBase1](docs/BillingAddressBase1.md)
 - [OrdersV2.BillingAddressFull](docs/BillingAddressFull.md)
 - [OrdersV2.CouponsResource](docs/CouponsResource.md)
 - [OrdersV2.CouponsResource1](docs/CouponsResource1.md)
 - [OrdersV2.Error](docs/Error.md)
 - [OrdersV2.FormFields](docs/FormFields.md)
 - [OrdersV2.FormFields1](docs/FormFields1.md)
 - [OrdersV2.InlineResponse200](docs/InlineResponse200.md)
 - [OrdersV2.InlineResponse400](docs/InlineResponse400.md)
 - [OrdersV2.OrderBase](docs/OrderBase.md)
 - [OrdersV2.OrderCount](docs/OrderCount.md)
 - [OrdersV2.OrderCount1](docs/OrderCount1.md)
 - [OrdersV2.OrderCouponsBase](docs/OrderCouponsBase.md)
 - [OrdersV2.OrderCouponsBase1](docs/OrderCouponsBase1.md)
 - [OrdersV2.OrderCustomProduct](docs/OrderCustomProduct.md)
 - [OrdersV2.OrderFull](docs/OrderFull.md)
 - [OrdersV2.OrderFull1](docs/OrderFull1.md)
 - [OrdersV2.OrderFull2](docs/OrderFull2.md)
 - [OrdersV2.OrderMessages](docs/OrderMessages.md)
 - [OrdersV2.OrderPost](docs/OrderPost.md)
 - [OrdersV2.OrderPost1](docs/OrderPost1.md)
 - [OrdersV2.OrderProduct](docs/OrderProduct.md)
 - [OrdersV2.OrderProductAppliedDiscounts](docs/OrderProductAppliedDiscounts.md)
 - [OrdersV2.OrderProductAppliedDiscounts1](docs/OrderProductAppliedDiscounts1.md)
 - [OrdersV2.OrderProductOptions](docs/OrderProductOptions.md)
 - [OrdersV2.OrderProductOptions1](docs/OrderProductOptions1.md)
 - [OrdersV2.OrderProductProductOptions](docs/OrderProductProductOptions.md)
 - [OrdersV2.OrderProducts](docs/OrderProducts.md)
 - [OrdersV2.OrderProducts1](docs/OrderProducts1.md)
 - [OrdersV2.OrderProducts2](docs/OrderProducts2.md)
 - [OrdersV2.OrderPut](docs/OrderPut.md)
 - [OrdersV2.OrderPut1](docs/OrderPut1.md)
 - [OrdersV2.OrderShipment](docs/OrderShipment.md)
 - [OrdersV2.OrderShipment1](docs/OrderShipment1.md)
 - [OrdersV2.OrderShipment2](docs/OrderShipment2.md)
 - [OrdersV2.OrderShipmentPost](docs/OrderShipmentPost.md)
 - [OrdersV2.OrderShipmentPost1](docs/OrderShipmentPost1.md)
 - [OrdersV2.OrderShipmentPost2](docs/OrderShipmentPost2.md)
 - [OrdersV2.OrderShippingAddress](docs/OrderShippingAddress.md)
 - [OrdersV2.OrderShippingAddress1](docs/OrderShippingAddress1.md)
 - [OrdersV2.OrderStatusBase](docs/OrderStatusBase.md)
 - [OrdersV2.OrderStatusBase1](docs/OrderStatusBase1.md)
 - [OrdersV2.OrderStatusCount](docs/OrderStatusCount.md)
 - [OrdersV2.OrderStatusOrderStatuses](docs/OrderStatusOrderStatuses.md)
 - [OrdersV2.OrderTaxesBase](docs/OrderTaxesBase.md)
 - [OrdersV2.OrderTaxesBase1](docs/OrderTaxesBase1.md)
 - [OrdersV2.OrdersCountFull](docs/OrdersCountFull.md)
 - [OrdersV2.OrdersCountFull1](docs/OrdersCountFull1.md)
 - [OrdersV2.OrdersShippingAddresses](docs/OrdersShippingAddresses.md)
 - [OrdersV2.OrdersorderIdshipmentsItems](docs/OrdersorderIdshipmentsItems.md)
 - [OrdersV2.ProductsResource](docs/ProductsResource.md)
 - [OrdersV2.ProductsResource1](docs/ProductsResource1.md)
 - [OrdersV2.ShippingAddressBase](docs/ShippingAddressBase.md)
 - [OrdersV2.ShippingAddressBase1](docs/ShippingAddressBase1.md)
 - [OrdersV2.ShippingAddressBase2](docs/ShippingAddressBase2.md)
 - [OrdersV2.ShippingAddressResource](docs/ShippingAddressResource.md)
 - [OrdersV2.ShippingAddressesPost](docs/ShippingAddressesPost.md)
 - [OrdersV2.ShippingAddressesResource](docs/ShippingAddressesResource.md)
 - [OrdersV2.ShippingQuotesBase](docs/ShippingQuotesBase.md)
 - [OrdersV2.ShippingQuotesBase1](docs/ShippingQuotesBase1.md)
 - [OrdersV2.ShippingQuotesResource](docs/ShippingQuotesResource.md)
 - [OrdersV2.ShippingQuotesResource1](docs/ShippingQuotesResource1.md)

## Documentation for Authorization


### X-Auth-Client

- **Type**: API key
- **API key parameter name**: X-Auth-Client
- **Location**: HTTP header

### X-Auth-Token

- **Type**: API key
- **API key parameter name**: X-Auth-Token
- **Location**: HTTP header

