CalculateOrder
Calculates the total for an order including taxes and discounts, returning the calculated order. This is a Beta API.
Stored Procedure Specific Information
Execute
You need to provide the Order aggregate to calculate totals including taxes and discounts. Note: This is a Beta API.
EXECUTE CalculateOrder Order = '{"location_id":"L9BJACN2YQPRA","line_items":[{"name":"Latte","quantity":"2","base_price_money":{"amount":350,"currency":"USD"}}]}'
You can optionally provide ProposedRewards as an aggregate to preview loyalty reward discounts:
EXECUTE CalculateOrder Order = '{"location_id":"L9BJACN2YQPRA","line_items":[{"name":"Latte","quantity":"2","base_price_money":{"amount":350,"currency":"USD"}}]}', ProposedRewards = '[{"id":"reward-id-001","reward_tier_id":"reward-tier-id-001"}]'
Input
| Name | Type | Required | Description |
| Order | String | True | The order to be calculated. Expects the entire order, not a sparse update. Pass raw JSON or aggregate. |
| ProposedRewards | String | False | Optional loyalty reward tiers for preview. Demonstrates discount effects without creating actual redemptions. Pass raw JSON or aggregate. |
Result Set Columns
| Name | Type | Description |
| Success | Boolean | Whether the operation was successful. |
| LocationId | String | The ID of the location for this order. |
| State | String | The state of the order (OPEN, COMPLETED, CANCELED). |
| Version | Int64 | The version of the order used for optimistic concurrency. |
| CreatedAt | Datetime | The timestamp when the order was created, in RFC 3339 format. |
| UpdatedAt | Datetime | The timestamp when the order was last updated, in RFC 3339 format. |
| TotalTaxMoneyAmount | Int64 | The total tax amount for the order in the smallest currency denomination. |
| TotalTaxMoneyCurrency | String | The currency code for the total tax amount. |
| TotalDiscountMoneyAmount | Int64 | The total discount amount for the order in the smallest currency denomination. |
| TotalDiscountMoneyCurrency | String | The currency code for the total discount amount. |
| TotalTipMoneyAmount | Int64 | The total tip amount for the order in the smallest currency denomination. |
| TotalTipMoneyCurrency | String | The currency code for the total tip amount. |
| TotalMoneyAmount | Int64 | The total amount for the order in the smallest currency denomination. |
| TotalMoneyCurrency | String | The currency code for the total order amount. |
| TotalServiceChargeMoneyAmount | Int64 | The total service charge amount for the order in the smallest currency denomination. |
| TotalServiceChargeMoneyCurrency | String | The currency code for the total service charge amount. |