# Create Order — Mews

> Create an order in Mews. See the documentation

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

## Description

Create an order in Mews. [See the documentation](https://mews-systems.gitbook.io/connector-api/operations/orders#add-order)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `accountType` | `string` | Yes | Type of account to be charged |
| `accountId` | `string` | Yes | Identifier of the Customer or Company to be charged. Company billing may not be enabled for your integration. Options are loaded from the connected account. |
| `serviceId` | `string` | Yes | Identifier of the Service to be ordered. Options are loaded from the connected account. |
| `billId` | `string` | No | Identifier of the Bill to which the created order will be assigned. The bill needs to be issued to the same account as the order. Options are loaded from the connected account. |
| `linkedReservationId` | `string` | No | Identifier of the Reservation to which the created order will be linked. Options are loaded from the connected account. |
| `consumptionUtc` | `string` | No | Date and time of the order consumption in UTC timezone in ISO 8601 format. If not specified, current date and time is used. |
| `notes` | `string` | No | Additional notes of the order. |
| `productOrders` | `string[]` | No | Array of product orders in JSON format. Each order must include: Required: ProductId (string) - Unique identifier of the Product to be ordered Optional: Count (number) - Count of products to be ordered (e.g. 10 in case of 10 beers) UnitAmount (object) - Unit amount of the product that overrides the amount defined in Mews: Currency (string) - ISO-4217 currency code GrossValue (number) - Gross value including all taxes NetValue (number) - Net value excluding taxes TaxCodes (string[]) - Tax codes applied to the amount StartUtc (string) - Product start in UTC timezone in ISO 8601 format (for Add order operation this can be omitted) EndUtc (string) - Product end in UTC timezone in ISO 8601 format (for Add order operation this can be omitted) Note: Either GrossValue or NetValue must be specified in amount objects, but not both. For products with charging Once and PerPerson, StartUtc and EndUtc must be set to the same value. Example: [ { "ProductId": "12345678-1234-1234-1234-123456789012", "Count": 2, "UnitAmount": { "Currency": "USD", "GrossValue": 15.50, "TaxCodes": ["VAT"] }, "StartUtc": "2025-01-01T00:00:00Z", "EndUtc": "2025-01-01T00:00:00Z" } ] |
| `items` | `string[]` | No | Array of custom items in JSON format. Each item must include: Required: Name (string) - Name of the item UnitCount (integer) - Count of units to be ordered (must be positive) UnitAmount (object) - Amount per unit of the item: Currency (string) - ISO-4217 currency code GrossValue (number) - Gross value including all taxes NetValue (number) - Net value excluding taxes TaxCodes (string[]) - Tax codes applied to the amount Optional: AccountingCategoryId (string) - Identifier of the Accounting Category Note: Either GrossValue or NetValue must be specified in UnitAmount, but not both. Example: [ { "Name": "Room Service", "UnitCount": 1, "UnitAmount": { "Currency": "USD", "GrossValue": 25.00, "TaxCodes": ["VAT"] }, "AccountingCategoryId": "87654321-4321-4321-4321-210987654321" } ] |

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

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: "mews-create-order",
  arguments: {
    accountType: "Account Type",
    accountId: "Account 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: "mews-create-order",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    mews: { authProvisionId: "apn_xxxxxxx" },
    accountType: "Account Type",
    accountId: "Account 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": "mews-create-order",
    "configured_props": {
      "mews": { "authProvisionId": "apn_xxxxxxx" },
      "accountType": "Account Type",
      "accountId": "Account ID"
    }
  }'
```

---

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