Calculate price of an order

Prev Next
Post
/pricing/v2/calculate-price

Given an order object, returns the price for that order.

Takes the subscription into account and uses the calculator defined in the subscription contract. This allows a merchant to define custom pricing strategies.

Security
HTTP
Type bearer
Header parameters
Authorization
stringRequired
Body parameters
Expand All
object
order
object Required
id
string Required

The order's unique identifier within the Bento system.

Example1
user_id
string Required

The customer's unique identifier, which merchants can opt to assign using either their own customer service system or Bento's customer service during the onboarding process.

Example1066
subscription_contract_id
string Required

The unique identifier of the Bento subscription contract. It can be retrieved from the Bento Subscription Service.

Examplea7ba8f43-a854-471d-99bc-9c366faba271
subscription_phase_id
string | null Required

The unique identifier of the phase ID within the subscription contract. It is to determine which phase the given order is currently in, and thus which pricing calculator to use.

Examplea7ba8f43-a854-471d-99bc-9c366faba271
number
number | null Required

The position of the order relative to other orders in the subscription contract. It serves as an identifier representing the sequential order number of the customer's lifetime orders under a specific contract. The first order in the subscription contract has ordinal '1'.

Example7
items
Array of object

Array of items within an order, each containing id, quantity, source and custom attribute data.

Example[ { "itemable_id": "1234", "quantity": 10.0, "source": "contract" } ]
object
itemable_id
string | null

A unique identifier for the product.

Example10c9ca24-1fc3-11ee-8ff9-0ab7ee5e7h7w
quantity
number | null Required

The quantity of this particular product within this order.

Example30
source
string Required

This is the source where the order item is added from. Could be from contract, product, order rule or admin edit.

Examplecontract
meta
object

Additional metadata for the order

Example{ "isGift": false }
meta
object
currencyCode
string

The currency to price the order in. The currency code should be provided in the 3 letter (ISO 4217 standard)[https://www.iso.org/iso-4217-currency-codes.html].

ExampleGBP
promotionCode
string

A promotion code that is to be applied to the order

Responses
200

A successful response with the final price of the order, determined by its associated subscription contract and current phase.

Expand All
object
data
object
totalPrice
number

The total price of the order in the currency's minor units, e.g., pence or cents.

Minimum0
Example2200
subtotalPrice
number

The price of order items after the subtotal discount is applied, excluding delivery, in the currency's minor units.

Minimum0
Example1900
deliveryPrice
number

The delivery price of the order in the currency's minor units, e.g., pence or cents.

Minimum0
Example300
totalDiscount
number

The total discount applied to the order in the currency's minor units, e.g., pence or cents.

Minimum0
Example100
subtotalDiscount
number

The discount applied to the subtotal in the currency's minor units, excluding delivery.

Minimum0
Example100
currencyCode
string

The currency to price the order in. The currency code should be provided in the 3 letter (ISO 4217 standard)[https://www.iso.org/iso-4217-currency-codes.html].

ExampleGBP
formattedTotalPrice
string

The formatted price of the order with the currency symbol provided.

Example£22.00
formattedTotalDiscount
string

The formatted total discount with the currency symbol provided.

Example£1.00
formattedSubtotalDiscount
string

The formatted discount applied to the subtotal with the currency symbol provided.

Example£1.00
formattedSubtotalPrice
string

The formatted price of order items after the discount is applied, excluding delivery.

Example£19.00
formattedDeliveryPrice
string

The formatted delivery price with the currency symbol provided.

Example£3.00
price
number

The final price of the order, truncating trailing zeros in the currency's highest denomination without the symbol e.g. twenty-two pounds -> 22, twenty-two pounds and five pence -> 22.05. The value considers delivery, discounts and the order phase.

Example22
400

Invalid Request

Expand All
object
message
string
causes
Array of object
object
message
string
metadata
Array of object
object
key
string
value
401

Invalid Authentication Credentials

Expand All
object
message
string
causes
Array of object
object
message
string
metadata
Array of object
object
key
string
value
403

Invalid Authorization Credentials

Expand All
object
message
string
causes
Array of object
object
message
string
metadata
Array of object
object
key
string
value
404

Resource Not Found

Expand All
object
message
string
causes
Array of object
object
message
string
metadata
Array of object
object
key
string
value
424

Failed Dependency

Expand All
object
message
string
causes
Array of object
object
message
string
metadata
Array of object
object
key
string
value
500

Internal Server Error

Expand All
object
message
string
causes
Array of object
object
message
string
metadata
Array of object
object
key
string
value