# Create Order — BaseLinker

> It allows adding a new order to the BaseLinker order manager. See the Documentation.

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

## Description

It allows adding a new order to the BaseLinker order manager. [See the Documentation](https://api.baselinker.com/index.php?method=addOrder).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `orderStatusId` | `string` | Yes | The ID of the order status. Options are loaded from the connected account. |
| `inventoryId` | `string` | No | The ID of the inventory in which the products are located. If the inventory ID is not provided, the products will be searched in the default inventory. Options are loaded from the connected account. |
| `currency` | `string` | No | 3-letter currency symbol (e.g. EUR, PLN) |
| `paymentMethod` | `string` | No | The payment method of the order. |
| `paymentMethodCOD` | `boolean` | No | Flag indicating whether the type of payment is COD (cash on delivery) |
| `paid` | `boolean` | No | Information whether the order is already paid. The value 1 automatically adds a full payment to the order. |
| `userComments` | `string` | No | Comments added by the customer when placing the order. |
| `adminComments` | `string` | No | Comments added by the seller to the order. |
| `email` | `string` | No | The email address of the customer who placed the order. |
| `wantInvoice` | `boolean` | No | Flag indicating whether the customer wants to receive an invoice. |
| `numberOfProducts` | `integer` | Yes | The number of products in the order. |

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

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: "baselinker-create-order",
  arguments: {
    orderStatusId: "Order Status ID",
    inventoryId: "Inventory ID",
  },
})
```

**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: "baselinker-create-order",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    baselinker: { authProvisionId: "apn_xxxxxxx" },
    orderStatusId: "Order Status ID",
    inventoryId: "Inventory ID",
  },
})

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": "baselinker-create-order",
    "configured_props": {
      "baselinker": { "authProvisionId": "apn_xxxxxxx" },
      "orderStatusId": "Order Status ID",
      "inventoryId": "Inventory ID"
    }
  }'
```

---

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