Connect API Documentation

https://connect.yourbarmate.com/api
Changelog

Scaled pricing

By default, total price is calculated based on the price property of the product and the quantity of the order.

Scaled pricing is for more complex cases when pricing might differ based on the volume of the order. It is a combination of price points and pricing strategies.

It also supports date overrides for special prices for certain periods or to implement seasonal pricing of fresh products.

Properties

  • strategy: The pricing strategy, one of "VOLUME", "INCREMENTAL", or "DIVISIBLE"
  • price_points: The prices used in the pricing based on the quantity of items.
    • from: The number of items the price point is applied from
    • price: The price for one item
  • date_overrides: Optional property, an array of date periods where the price points are different from the default ones. Each item of the array can have the following properties:
    • from_date: The start of the validity for the date override. Can be open ended if no to_date is given.
    • to_date: Optional field, represents the last day of the date range. It is inclusive, the override is still valid on this date.
    • price_points: The price points to be used for this date range or from this start date.

Example:

{
"pricing": {
"strategy": "INCREMENTAL",
"price_points": [
{ "from": 1, "price": 2675 },
{ "from": 6, "price": 2650 },
{ "from": 96, "price": 2610 }
],
"date_overrides": [
{
"from_date": "2023-11-25",
"to_date": "2023-11-28",
"price_points": [
{ "from": 1, "price": 2650 },
{ "from": 6, "price": 2610 },
{ "from": 96, "price": 2575 }
]
}
]
}
}

It is recommended to add a price point with from = 1, or if order_by is kg and strategy is VOLUME then from = 0. The shop will not use the price set on the product itself if scaled pricing is defined.

Constraints

  • The smallest price point defines min_order_count, if not provided. If provided, they must match.
  • order_by: 'kg' can only be used with the VOLUME strategy. The price points from field may be a float only in this case.
  • Within date_overrides, dates cannot overlap. The to_date is optional, if not defined the date range ends at the next from_date, or never.
  • DIVISIBLE and INCREMENTAL strategies require from to be ≥ 1 – zero is not allowed.
  • When using the DIVISIBLE strategy, if bundles are defined on the product, all price points have to be a factor of one bundle vessel count.
  • If order_by is kg the from field may be a float. It has to be an integer ≥ 1 otherwise.

Strategies

Scaled pricing supports three strategies: VOLUME, INCREMENTAL and DIVISIBLE

VOLUME

This is the most straightforward pricing strategy, the more a customer orders, the cheaper the product becomes.

Example:

{
"pricing": {
"strategy": "VOLUME",
"price_points": [
{ "from": 1, "price": 2675 },
{ "from": 50, "price": 2650 },
{ "from": 100, "price": 2625 }
]
}
}

With the pricing above here are some quantities with their total price:

number of items calculation total
49 items 49 x 26.75 1310.75
50 items 50 x 26.50 1325.00
99 items 99 x 26.50 2623.50
100 items 100 x 26.25 2625.00

INCREMENTAL

This strategy will break the pricing down to multiples of price points. If you have different bundles for a product and they are priced differently base on their size, this strategy will find the breakdown for a customer's order. Let's say there are two shipping bundles, a carton of 12 and a pallet of 8 cartons (96 items). If a customer orders 13 cartons (156 items), it will be shipped and priced as one pallet and five cartons.

Example:

{
"pricing": {
"strategy": "INCREMENTAL",
"price_points": [
{ "from": 1, "price": 2675 },
{ "from": 12, "price": 2650 },
{ "from": 96, "price": 2625 }
]
}
}

With the pricing above here are some quantities with their total price:

number of items calculation total
11 items 11 x 26.75 294.25
12 items 12 x 26.50 318.00
95 items 7 x 12 x 26.50 + 11 x 26.75 2520.25
111 items 96 x 26.25 + 12 x 26.50 + 3 x 26.75 2918.25

DIVISIBLE

This is the bundle pricing strategy, prices will always be calculated based on the highest price point that is divisible with the quantity ordered. Unlike INCREMENTAL, this strategy will only apply one price point, the one with the highest from value that is divisible with the quantity.

Example:

{
"pricing": {
"strategy": "DIVISIBLE",
"price_points": [
{ "from": 1, "price": 2675 },
{ "from": 12, "price": 2650 },
{ "from": 96, "price": 2625 }
]
}
}

With the pricing above here are some quantities with their total price:

number of items calculation total
11 items 11 x 26.75 294.25
12 items 12 x 26.50 318.00
36 items 3 x 12 x 26.50 318.00
95 items 95 x 26.75 2520.25
96 items 96 x 26.25 2918.25
192 items 2 x 96 x 26.25 2918.25

Date Overrides

Price points can be defined for specific date ranges or from specific dates by using the date_overrides property. When a customer is placing an order, the price points from the date override with the latest from_date will be applied, if any found.

If a date override is found, the original price points are completely ignored and replaced with the price points from the override.

Example:

{
"strategy": "VOLUME",
"price_points": [
{ "from": 1, "price": 2700 },
{ "from": 100, "price": 2650 }
],
"date_overrides": [
{
// Q3
"from_date": "2023-07-01",
"price_points": [
{ "from": 1, "price": 2700 },
{ "from": 100, "price": 2550 }
]
},
{
// Q4
"from_date": "2023-10-01",
"price_points": [
{ "from": 1, "price": 2700 },
{ "from": 100, "price": 2575 }
]
},
{
// Black Friday
"from_date": "2023-11-25",
"to_date": "2023-11-28",
"price_points": [
{ "from": 1, "price": 2700 },
{ "from": 100, "price": 2475 }
]
}
]
}

With the above setup, given the date of ordering, the price for 100 items will be:

date of order date override price for 100 items
16th of June 2023 none 2650.00
7th of July 2023 Q3 2550.00
22nd of November Q4 2575.00
26th of November Black Friday 2475.00
21st of December Q4 2575.00