> Part of [WHCC Developer Documentation](https://www.whcc.com/developer/llms.txt)

# Ordering

WHCC provides a simple API to order the products designed in editors for processing and production.

A single editor or a collection of editors can be ordered at once to allow you to provide a standard cart experience to your users.

This is currently a 3 step process consisting of:

> If you have an existing [Order Submit API](https://www.whcc.com/developer/docs/order-submit-api/order-import/index.html.md) integration, that can be used for submitting orders by leveraging [data from the Editor API](https://www.whcc.com/developer/docs/editor-api/order-export/index.html.md)

## 1. Export Editors

For more detail on exporting editors, see the [Exporting Editors for Ordering](https://www.whcc.com/developer/docs/editor-api/order-export/index.html.md) page.

### PUT `/oas/editors/export`

Content-type: application/json

### curl

#### CURL Example Request

The only required value is a single `editorId` in the `editors` array. Any required fields for OrderImport will be intialized to `null` and will need to be provided by your integration code otherwise the order will be rejected.

```shell
curl https://prospector.dragdrop.design/api/v1/oas/editors/export \
	-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.r3udhowqndkwqneoiqwndjwndei12u390912hrbfhaslkdjbqwiei21nbrhewiuornqwjkfhbaiwodnqwjkbdawuosdhowqubdfjkwbdusandbiwquebio12nedbwbaodpqwnebou12rbwkjalndawuobdnwqndfqwbdfoiwqndpiqwhfiwqnkjdlnwqdnioqwhniorqw3nfjwbaodnwdnqwopd" \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	-d '{"editors": [{ "editorId": "sampleEditorId" }]}'
```

#### Example Response

```json
{
    "items": [
    {
        "id": "sampleEditorId",
        "pricing": {
            ...
        },
        "editor": {
            "id": "sampleEditorId",
            ...
        }
    }],
    "order": {
        "EntryId": "SampleEntryId",
        "Orders": [
            {
                ...
            }
        ]
    },
    "pricing": {
        ...
    }
}
```

## 2. Create Order

To create an order, pass the `order` object directly as the payload `/oas/orders/create`.

> The needed `order` is returned from the `/oas/editors/export` call.

For more detail on creating orders, see the [analogous documentation for the Order Submit API](https://www.whcc.com/developer/docs/order-submit-api/order-import/index.html.md).

### POST `/oas/orders/create`

Content-type: application/json

### curl

#### CURL Example Request

```shell
curl https://prospector.dragdrop.design/api/v1/oas/orders/create \
	-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.r3udhowqndkwqneoiqwndjwndei12u390912hrbfhaslkdjbqwiei21nbrhewiuornqwjkfhbaiwodnqwjkbdawuosdhowqubdfjkwbdusandbiwquebio12nedbwbaodpqwnebou12rbwkjalndawuobdnwqndfqwbdfoiwqndpiqwhfiwqnkjdlnwqdnioqwhniorqw3nfjwbaodnwdnqwopd" \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	-d '{"EntryId":"12345","Orders":[{"SequenceNumber":1,"Instructions":null,"Reference":"OrderID 12345","SendNotificationEmailAddress":null,"SendNotificationEmailToAccount":true,"ShipToAddress":{"Name":"Chris Hanline","Attn":null,"Addr1":"2840 Lone Oak Parkway","Addr2":null,"City":"Eagan","State":"MN","Zip":"55121","Country":"US","Phone":"6516468263"},"ShipFromAddress":{"Name":"Returns Department","Addr1":"3432 Denmark Ave","Addr2":"Suite 390","City":"Eagan","State":"MN","Zip":"55123","Country":"US","Phone":"8002525234"},"OrderAttributes":[{"AttributeUID":96},{"AttributeUID":545}],"OrderItems":[{"ProductUID":2,"Quantity":1,"ItemAssets":[{"ProductNodeID":10000,"AssetPath":"https://whcc-api-testing.s3.amazonaws.com/sample-images/sample-image-1.jpg","ImageHash":"a9825bb0836325e07ccfed16751b1d07","PrintedFileName":"sample-image-1.jpg","AutoRotate":true}],"ItemAttributes":[{"AttributeUID":1},{"AttributeUID":5}]}]}]}'
```

### Example Response

```json
{
	"Account": "10072",
	"ConfirmationID": "d4bcb9a7-caf0-4d2b-aa18-674a5d2c527e",
	"EntryID": "",
	"Key": "B431BE78D2E9FFFE3709",
	"NumberOfOrders": 1,
	"Orders": [{
		"LineItems": [],
		"Note": "",
		"Products": [{
			"Price": "0.65",
			"ProductDescription": "Print Fulfillment 5x7",
			"Quantity": 1
		}, {
			"Price": "3.48",
			"ProductDescription": "Fulfillment Shipping - Economy",
			"Quantity": 1
		}],
		"SequenceNumber": "1",
		"SubTotal": "4.13",
		"Tax": "0.29",
		"Total": "4.42"
	}],
	"Received": "8/19/2018 4:34:01 PM Central Time"
}
```

> Your order will not be processed until you confirm the order using the returned `ConfirmationId`.

## 3. Confirm Order

You need to confirm each order after creating before they will be processed. For more detail on confirming orders, see the [analogous documentation for the Order Submit API](https://www.whcc.com/developer/docs/order-submit-api/order-submit/index.html.md).

> The needed `ConfirmationID` value is returned from the `/oas/orders/create` call.

### POST `/oas/orders/[ConfirmationId]/confirm`

### curl

#### Example Request

```shell
curl https://prospector.dragdrop.design/api/v1/oas/orders/a3ff9b4a-3112-4101-88ab-6ba025fd7600/confirm \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.r3udhowqndkwqneoiqwndjwndei12u390912hrbfhaslkdjbqwiei21nbrhewiuornqwjkfhbaiwodnqwjkbdawuosdhowqubdfjkwbdusandbiwquebio12nedbwbaodpqwnebou12rbwkjalndawuobdnwqndfqwbdfoiwqndpiqwhfiwqnkjdlnwqdnioqwhniorqw3nfjwbaodnwdnqwopd" \
-X POST
```

#### Example Response

```json
{
	"Confirmation": "Entry ID=a3ff9b4a-3112-4101-88ab-6ba025fd7600: Confirmed order submitted.",
	"ConfirmationID": "a3ff9b4a-3112-4101-88ab-6ba025fd7600",
	"ConfirmedOrders": 1,
	"Received": "8/19/2018 5:00:17 PM Central Time"
}
```

> ### What's Next
>
> Integrate [Webhooks](https://www.whcc.com/developer/docs/editor-api/webhooks/index.html.md) to be updated on the processing status of an order as well as possible errors.