# Create Order — Order Desk

> Create Order See the documentation.

- Key: `order_desk-create-order`
- Type: Action (Write)
- Version: 0.0.2
- App: Order Desk (`order_desk`) — https://pipedream.com/apps/order-desk.md
- This page (HTML): https://pipedream.com/apps/order-desk/actions/create-order
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/order_desk/actions/create-order/create-order.mjs

## Description

Create Order [See the documentation](https://apidocs.orderdesk.com/#create-an-order).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `order_items` | `string[]` | Yes | A valid JSON string. Order Items Object can have the following properties: id, name, price, quantity, weight, code, delivery_type, category_code, variation_list, metadata. Please check the documentation in the description for more information. |
| `customer_first_name` | `string` | No | Customer first name |
| `customer_last_name` | `string` | No | Customer last name |
| `customer_company` | `string` | No | Customer company |
| `shipping_first_name` | `string` | No | Shipping first name |
| `shipping_last_name` | `string` | No | Shipping last name |
| `shipping_company` | `string` | No | Shipping company |
| `source_id` | `string` | No | Your order ID. If blank, Order Desk's internal ID will be used read-only. |
| `source_name` | `string` | No | Pick from Available Source Names. Defaults to Order Desk. |
| `email` | `string` | No | Customer email address |
| `shipping_method` | `string` | No | Name of shipping method selected. |
| `quantity_total` | `string` | No | Total number of items in the order. |
| `weight_total` | `string` | No | Total weight of the order. |
| `product_total` | `string` | No | Total cost of all items in the order. |
| `shipping_total` | `string` | No | Total cost of shipping. |
| `handling_total` | `string` | No | Total cost of handling. |
| `tax_total` | `string` | No | Total cost of tax. |
| `discount_total` | `string` | No | Total cost of discounts. |
| `order_total` | `string` | No | Total cost of the order. |
| `cc_number` | `string` | No | Obfuscated credit card number. Enter only the last four digits. |
| `cc_exp` | `string` | No | Credit card expiration date in MM/YYYY format. |
| `processor_response` | `string` | No | Gateway transaction ID in format <gateway_name>: <transaction_id> |
| `payment_type` | `string` | No | Payment type. Can be Visa, Paypal, Mastercard, etc |
| `payment_status` | `string` | No | Payment status. Can be Approved, Authorized, Captured, Fully Refunded, Partially Refunded, Pending, Rejected, Voided |
| `processor_balance` | `string` | No | The amount that the was charged at the processor. This amount will be decremented when refunds are made. By default it will be set the same as order_total |
| `refund_total` | `string` | No | The amount that jhas been refunded on the order from within Order Desk. This is generally something that will be set internally. |
| `customer_id` | `string` | No | The ID of the customer. This is generally something that will be set internally. |
| `ip_address` | `string` | No | The IP address of the customer. |
| `fulfillment_id` | `string` | No | The internal ID of the fulfillment service will be saved here for some services. |
| `fulfillment_name` | `string` | No | Once the order has been sent for fulfillment, the name of the fulfillment method is entered here. |
| `folder_id` | `string` | No | The ID number of the folder in which the order is stored. If nothing is entered when adding an order, the folder will be the first folder in the list. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "order_desk",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "order_desk-create-order",
  arguments: {
    order_items: ["Order Items"],
    customer_first_name: "Customer First Name",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "order_desk-create-order",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    order_desk: { authProvisionId: "apn_xxxxxxx" },
    order_items: ["Order Items"],
    customer_first_name: "Customer First Name",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "order_desk-create-order",
    "configured_props": {
      "order_desk": { "authProvisionId": "apn_xxxxxxx" },
      "order_items": ["Order Items"],
      "customer_first_name": "Customer First Name"
    }
  }'
```

---

- App: https://pipedream.com/apps/order-desk.md · All apps: https://pipedream.com/apps
