> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Calculate Order

> Enables applications to preview order pricing without creating an order.

`square.calculateOrder` enables applications to preview order pricing without creating an order.

## Example

```ts automations/square-calculate-order.automation.ts theme={null}
import { automation, onDashboardRun } from "automate.ax"
import { square } from "automate.ax/square"

export default automation("Calculate Square Order", () => {
  onDashboardRun({ title: "Calculate Square Order" })

  square.calculateOrder({
    order: {
      locationId: "D7AVYMEAPJ3A3",
      lineItems: [
        {
          name: "Item 1",
          quantity: "1",
          basePriceMoney: {
            amount: BigInt("500"),
            currency: "USD",
          },
        },
        {
          name: "Item 2",
          quantity: "2",
          basePriceMoney: {
            amount: BigInt("300"),
            currency: "USD",
          },
        },
      ],
      discounts: [
        {
          name: "50% Off",
          percentage: "50",
          scope: "ORDER",
        },
      ],
    },
  })
})
```

## Inputs

Every input accepts a compatible signal. It does not require an additional Square OAuth permission.

| Field             | Type                           | Required | Default | Description                                                                                                                                                                                                                                                                                                                                                                                      |
| ----------------- | ------------------------------ | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `order`           | `Square.Order`                 | Yes      | —       | The order to be calculated. Expects the entire order, not a sparse update.                                                                                                                                                                                                                                                                                                                       |
| `proposedRewards` | `Square.OrderReward[] \| null` | No       | —       | Identifies one or more loyalty reward tiers to apply during the order calculation. The discounts defined by the reward tiers are added to the order only to preview the effect of applying the specified rewards. The rewards do not correspond to actual redemptions; that is, no `reward`s are created. Therefore, the reward `id`s are random strings used only to reference the reward tier. |

Use the official [CalculateOrder reference](https://developer.squareup.com/reference/square/orders-api/calculate-order) for provider field semantics and limits.

## Output

Returns the official `Square.CalculateOrderResponse` response as a codec-safe object. Square integer money amounts remain `bigint` values.
