# Create Customer Order — Allocadence

> Creates a new customer order. See the documentation

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

## Description

Creates a new customer order. [See the documentation](https://docs.allocadence.com/#tag/customer_order/paths/~1customer-orders/post)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `orderNumber` | `string` | No | Order number for the customer order. |
| `clientId` | `integer` | No | Id of the client that the customer order is for. |
| `clientName` | `string` | No | Name of the client that the customer order is for. Ignored if clientId is provided and is nonzero. |
| `customerId` | `integer` | No | Id of the customer. If none is provided, will attempt to find an existing customer based on the other customer fields and shipping address. Other fields not used if id is provided. |
| `title` | `string` | No | The title of the customer. |
| `name` | `string` | No | A combination of name and surname is required if the customer is new. |
| `surname` | `string` | No | A combination of name and surname is required if the customer is new. |
| `email` | `string` | No | The email of the customer. |
| `customerCompany` | `string` | No | The company of the customer. |
| `accountNumber` | `string` | No | Will only match a customer on this field if provided. |
| `shippingAddressId` | `integer` | No | Id of the shipping address. Other Shipping fields will not be used if provided. |
| `shippingAddressCode` | `string` | No | Used to find an existing address. Other fields not used if an address is successfully found. |
| `shippingAddressCompany` | `string` | No | The company of the shipping address. |
| `shippingAddressName` | `string` | No | The name of the shipping address. |
| `shippingAddressline1` | `string` | No | The shipping address line 1. |
| `shippingAddressline2` | `string` | No | The shipping address line 2. |
| `shippingAddressline3` | `string` | No | The shipping address line 3. |
| `shippingAddressCity` | `string` | No | The city of the shipping address. |
| `shippingAddressState` | `string` | No | The state of the shipping address. |
| `shippingAddressZip` | `string` | No | The zip of the shipping address. |
| `shippingAddressCountryCode` | `string` | No | The country code of the shipping address. See the ISO 3166 codes. |
| `shippingAddressPhone` | `string` | No | The phone of the shipping address. |
| `sameAsShipping` | `boolean` | No | True if the billing address is the same as the shipping address. |
| `shipFromWarehouseId` | `string` | No | Id of the warehouse the ordered items will be allocated from. If no warehouse parameters are given, then the user's current warehouse will be used. |
| `shipFromWarehouseName` | `string` | No | Name of the warehouse the ordered items will be allocated from. Ignored if warehouseId is provided. |
| `shipVia` | `string` | No | Code of the carrier or service to use for shipping. |
| `postageAccount` | `string` | No | Who to bill for shipping. |
| `items` | `string[]` | No | An array of objects of ordered items. Example: {"itemId": "123", "sku": "SKU123", "quantity": 1} See the documentation fro further information. |

## 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": "allocadence",
      },
    },
  },
)

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: "allocadence-create-customer-order",
  arguments: {
    orderNumber: "Order Number",
    clientId: 10,
  },
})
```

**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: "allocadence-create-customer-order",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    allocadence: { authProvisionId: "apn_xxxxxxx" },
    orderNumber: "Order Number",
    clientId: 10,
  },
})

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": "allocadence-create-customer-order",
    "configured_props": {
      "allocadence": { "authProvisionId": "apn_xxxxxxx" },
      "orderNumber": "Order Number",
      "clientId": 10
    }
  }'
```

---

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