Calculates the price of the provided order
  • 22 Nov 2024
  • 2 Minutes to read
  • Contributors
  • Dark
    Light

Calculates the price of the provided order

  • Dark
    Light

Article summary

Post
/pricing/v2/predict-price

Given a request, return the expected price based on the pricing engine for the subscription.

Security
HTTP
Type bearer
Header parameters
Authorization
stringRequired
Body parameters
Expand All
object
order
object Required
customerId
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
subscriptionContractId
string Required

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

Examplea7ba8f43-a854-471d-99bc-9c366faba271
subscriptionPhaseId
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
orderNumber
number Required

The position of the order relative to other orders in the subscription contract. The first order in the subscription contract has orderNumber '1'.

Minimum1
subscriptionOrderNumber
number

The number of the order in the linked subscription contract, independent of number of boxes received. This is often the same as orderNumber but doesn't have to be, for example if a customer starts halfway through an ordered subscription. Useful for custom tracking of orders e.g., playlists.

Minimum1
items
Array of object

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

Example[ { "id": "1234", "quantity": 10.0, "source": "contract" } ]
object
id
string | null
quantity
number Required
Minimum1
source
string Required
currencyCode
string Required

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].

promotionCode
string

A promotion code that is to be applied to the order

Responses
200

Price of the provided order

Expand All
object
data
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].

totalPrice
number

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

Minimum0
Example1234
formattedPrice
string

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

Example£12.34
totalDiscount
number

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

Minimum0
Example200
formattedTotalDiscount
string

The formatted total discount with the currency symbol provided.

Example£2.00
subtotalPrice
number

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

Minimum0
Example1500
formattedSubtotalPrice
string

The formatted price of order items after the subtotal discount is applied with the currency symbol provided.

Example£15.00
subtotalDiscount
number

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

Minimum0
Example150
formattedSubtotalDiscount
string

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

Example£1.50
deliveryPrice
number

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

Minimum0
Example500
formattedDeliveryPrice
string

The formatted delivery price with the currency symbol provided.

Example£5.00
400

Invalid Request

Expand All
object
errors
Array of object
object
status
number
title
string

Human-readable title for the error

description
string

Human-readable description for the error

401

Invalid Authentication Credentials

Expand All
object
errors
Array of object
object
status
number
title
string

Human-readable title for the error

description
string

Human-readable description for the error

403

Invalid Authorization Credentials

Expand All
object
errors
Array of object
object
status
number
title
string

Human-readable title for the error

description
string

Human-readable description for the error

404

Resource Not Found

Expand All
object
errors
Array of object
object
status
number
title
string

Human-readable title for the error

description
string

Human-readable description for the error

500

Internal Server Error

Expand All
object
errors
Array of object
object
status
number
title
string

Human-readable title for the error

description
string

Human-readable description for the error


Was this article helpful?