# Save Order — Paazl

> Saves an order's most important information to the Paazl database once a customer has paid for their purchase. See the documentation

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

## Description

Saves an order's most important information to the Paazl database once a customer has paid for their purchase. [See the documentation](https://support.paazl.com/hc/en-us/articles/360008633973-REST-API-reference#/Order/saveOrderUsingPOST)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `reference` | `string` | Yes | Your own order reference for a purchase transaction. Must be unique within the webshop. |
| `consignee` | `object` | Yes | Contains details of the party to which an order is shipped. Fields: companyName (string): The name of a company to which an order is shipped. Example: "Bonn Mac Tosch" vatNumber (string): The VAT number of the receiver. Example: "vat-123456789" email (string): The email address of the person to whom an order is shipped. Example: "freddie.kwiksilver@konningin.org" name (string): The name of the person to whom an order is shipped. Example: "Friederich Feuerstein" other (string): Additional details used to identify the person to whom an order is shipped. Example: "Logistik Manager" phone (string): The phone number of the person to whom an order is shipped. Example: "+31-20-7736303" locale (string): Specifies the language of the email templates used for track & trace notifications. Format: {language}_{country} (e.g., fr_FR) address (object): Contains details of the address to which an order is shipped. Address Fields: city (string): The city or town. Example: "Bonn" country (string): ISO 3166-2 code. Example: "DE" postalCode (string): Postal code. Example: "53111" province (string): Province/state code. Example: "NW" street (string): Street name. Example: "Am Hauptbahnhof" streetLines (array): Additional street lines. houseNumber (integer): House number. Example: 9 houseNumberExtension (string): House number extension. Example: "-A" Example: { "companyName": "Bonn Mac Tosch", "vatNumber": "vat-123456789", "email": "freddie.kwiksilver@konningin.org", "name": "Friederich Feuerstein", "other": "Logistik Manager", "phone": "+31-20-7736303", "locale": "fr_FR", "address": { "city": "Bonn", "country": "DE", "postalCode": "53111", "province": "NW", "street": "Am Hauptbahnhof", "streetLines": ["Am Hauptbahnhof 9"], "houseNumber": 9, "houseNumberExtension": "-A" } } |
| `customsValue` | `object` | No | The total monetary value for customs purposes. Fields: value (number): The monetary value of an order for customs purposes. Example: 40.2 currency (string): The ISO 4217 code for the currency. The default code is "EUR". Example: "USD" description (string): The description of the customs value. Example: "Customs value description" Example: { "value": 40.2, "currency": "USD", "description": "Customs value description" } |
| `insuredValue` | `object` | No | The amount for which this order is insured by the carrier against loss, damage, or accident during transport. Fields: value (number): The amount of insurance coverage requested from the carrier. Example: 500.0 currency (string): The ISO 4217 code for the currency. The default code is "EUR". Example: "USD" description (string): The description of the insured value. Example: "Insured value description" Example: { "value": 500.0, "currency": "USD", "description": "Insured value description" } |
| `codValue` | `object` | No | The amount that a consignee has to pay before receiving the "Cash On Delivery" consignment. Fields: value (number): The amount that has to be paid by receiver before receiving the goods. Example: 40.2 currency (string): The ISO 4217 code for the currency. The default code is "EUR". Example: "USD" description (string): The description of the COD value. Example: "COD value description" Example: { "value": 40.2, "currency": "USD", "description": "COD value description" } |
| `description` | `string` | No | A general description of the contents of a shipment |
| `requestedDeliveryDate` | `string` | No | The date on which a customer has requested that an order be delivered (format: YYYY-MM-DD) |
| `products` | `string[]` | No | Contains objects representing the products making up an order. Fields: height (integer): The height of a product, in centimeters (cm). Example: 10 length (integer): The length of a product, in centimeters (cm). Example: 30 unitPrice (object): The value of a product. value (number): The monetary value of a product. Example: 40.2 currency (string): The ISO 4217 code for the currency. Default: "EUR". Example: "USD" description (string): The description of the product. Example: "Zhitomir socks" quantity (integer, required): The number of items of a product in a shipment. Example: 7 volume (number): The volume of a product, including packaging, in cubic meters (m³). Example: 0.015625 weight (number): The weight of a product, in kilograms (kg). Example: 100 width (integer): The width of a product, in centimeters (cm). Example: 20 countryOfManufacture (string): The ISO 3166-2 code for the country in which a product was manufactured. Example: "DE" description (string): A description of the contents of a specific product. Example: "Zhitomir socks" hsTariffCode (string): The import Harmonized System code of a product. Example: "62034231" skuCode (string): The SKU code of a product. Example: "8754-124-990" or "KS944RUR" Example: [ { "height": 10, "length": 30, "unitPrice": { "value": 40.2, "currency": "USD", "description": "Zhitomir socks" }, "quantity": 7, "volume": 0.015625, "weight": 100, "width": 20, "countryOfManufacture": "DE", "description": "Zhitomir socks", "hsTariffCode": "62034231", "skuCode": "8754-124-990" } ] |
| `invoiceNumber` | `string` | No | The invoice number of an order (sometimes required for international shipments) |
| `invoiceDate` | `string` | No | The invoice date of an order (format: YYYY-MM-DD) |
| `returnProp` | `object` | No | Contains the details of an address to which an order is returned. Fields: description (string): The description of the return address. Example: "Return address description" name (string): The name of the party to which an order is returned. Example: "A'dam Mac Tosch" address (object): Contains details of the address to which an order is returned. city (string, required if address is provided): The city or town. Example: "Bonn" country (string): ISO 3166-2 code for the country. Example: "DE" postalCode (string): Postal code. Example: "53111" province (string): Last 2 letters of the ISO 3166-2 code for the province/state. Example: "NW" street (string): Name of the street. Example: "Jacob Bontousplaats" streetLines (array of strings): Street name and house number, one or more strings. Example: ["Jacob Bontiusplaats 9", "Unit 580"] houseNumber (integer): House number. Example: 9 houseNumberExtension (string): House number extension (e.g., "-A"). Example: "-A" Example: { "description": "Return address description", "name": "A'dam Mac Tosch", "address": { "city": "Bonn", "country": "DE", "postalCode": "53111", "province": "NW", "street": "Jacob Bontiusplaats", "streetLines": ["Jacob Bontiusplaats 9", "Unit 580"], "houseNumber": 9, "houseNumberExtension": "-A" } } |
| `sender` | `object` | No | Contains the details of the address from which an order is shipped. Fields: description (string): The description of the sender address. Example: "Sender address description" name (string): The name of the party that shipped an order. Example: "A'dam Mac Tosch" address (object, required if provided): Contains details of the address from which an order is shipped. city (string, required if address is provided): The city or town from which an order is shipped. Example: "Bonn" country (string): ISO 3166-2 code for the country. Example: "DE" postalCode (string): Postal code. Example: "53111" province (string): Last 2 letters of the ISO 3166-2 code for the province/state. Example: "NW" street (string): Name of the street. Example: "John Plagis Avenue" streetLines (array of strings): Street name and house number, one or more strings. Example: ["6 John Plagis Avenue", "Around the corner"] houseNumber (integer): House number. Example: 6 houseNumberExtension (string): House number extension (e.g., "-A"). Example: "-A" Note: If not provided, the default value is the address specified in your web app account under Settings > Account > My address book > Sender address. Example: { "description": "Sender address description", "name": "A'dam Mac Tosch", "address": { "city": "Bonn", "country": "DE", "postalCode": "53111", "province": "NW", "street": "John Plagis Avenue", "streetLines": ["6 John Plagis Avenue", "Around the corner"], "houseNumber": 6, "houseNumberExtension": "-A" } } |
| `shipping` | `object` | Yes | Contains information on the shipping option selected by a customer. Fields: option (string, required): A shipping option's Paazl identifier. Example: "AVG" pickupLocation (object, optional): If your customer selected a pickup location at checkout, this object contains information on that location. description (string, optional): The description of the pickup location. Example: "Pickup location description" accountNumber (string, optional): An account number that a carrier can issue to customers for managing delivery of their parcel to a collection point. code (string, required if pickupLocation is provided): A carrier's unique code for a pickup location. Example: "NOP12345" contract (string, optional): The identification code of your carrier contract for an outbound shipment. Example: "XYZ123" returnContract (string, optional): The identification code of your carrier contract for a return shipment. Example: "321ZYX" packageCount (integer, optional): The number of packages in a shipment. Example: 3 multiPackageShipment (boolean, optional): If true, Paazl will treat the shipment as consolidated. Example: false Example: { "option": "AVG", "pickupLocation": { "description": "Pickup location description", "accountNumber": "123456789", "code": "NOP12345" }, "contract": "XYZ123", "returnContract": "321ZYX", "packageCount": 3, "multiPackageShipment": false } |
| `weight` | `string` | No | The total weight in kilograms (kg) of an order, including packaging |
| `additionalInstruction` | `string` | No | Additional instructions for the delivery of an 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": "paazl",
      },
    },
  },
)

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: "paazl-save-order",
  arguments: {
    reference: "Order Reference",
    consignee: "Consignee",
  },
})
```

**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: "paazl-save-order",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    paazl: { authProvisionId: "apn_xxxxxxx" },
    reference: "Order Reference",
    consignee: "Consignee",
  },
})

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": "paazl-save-order",
    "configured_props": {
      "paazl": { "authProvisionId": "apn_xxxxxxx" },
      "reference": "Order Reference",
      "consignee": "Consignee"
    }
  }'
```

---

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