# Pricing

Add `octo/pricing` to your `OCTO-Capabilities` header

This capability will indicate pricing for the requested product dynamically returning product pricing for each day or departure time. &#x20;

The following endpoints will have pricing details added to them when the `octo/pricing` capability is added to your requests.  In general this includes:

* **Product pricing** - as a list of products, or single product
* **Pricing checks** - at the time of making an Availability call, we will confirm the price with you.  Also handy for performing a price quote.
* **Booking** - at the time of making a booking, our system will return pricing details for the booking.

{% hint style="info" %}
NOTE:   we will return `pricingFrom` for each unit in each available currency. &#x20;
{% endhint %}

## Product Pricing

<mark style="color:blue;">`GET`</mark> `https://api.zaui.io/octo/suppliers/:sid/products/:id`

Returns the product(s) with pricing added to the units

#### Path Parameters

| Name | Type   | Description     |
| ---- | ------ | --------------- |
| id   | number | The product ID  |
| sid  | number | The supplier ID |

{% tabs %}
{% tab title="200 " %}

```javascript
{
   //rest of the product object
   "units":[{
       //... pricing unit object
      "pricingFrom": [
       {
          "original": 4500,
          "retail": 4500,
          "net": 3500,
          "currency": "USD",
          "currencyPrecision": 2,
          "includedTaxes": [
            {
              "name": "VAT 10",
              "retail": 800,
              "net": 500
            }
          ]
        },
        {
          "original": 4000,
          "retail": 4000,
          "net": 3000,
          "currency": "GBP",
          "currencyPrecision": 2,
          "includedTaxes": [
            {
               "name": "VAT 10",
               "retail": 700,
               "net": 400
            }
          ]
        }       
      ],
    }]
}
```

{% endtab %}
{% endtabs %}

#### Pricing From Field Definitions

| Field               | Description                                                                                                                                                                                               |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `original`          | The original price for this product which will be the same or higher than the sale amount.                                                                                                                |
| `retail`            | The sale price you should charge your customers.                                                                                                                                                          |
| `net`               | The wholesale rate the supplier will charge you for this sale.                                                                                                                                            |
| `currency`          | The currency.                                                                                                                                                                                             |
| `currencyPrecision` | We send back pricing in integers.  This value indicates the currency precision so as to avoid rounding errors.  For example, CAD = 2, USD = 2.  eg.  subtotal = subtotal / (10 \*\* `currencyPrecision`). |
| `includedTaxes`     | Any taxes included in the retail and/or net price.                                                                                                                                                        |

### Product Object Additions

We have added the following changes to the Product object for pricing:

```javascript
{
  //rest of the Product Object
  "defaultCurrency": "CAD",
  "availableCurrencies": ["CAD", "EUR", "GBP"],
  "pricingPer": "UNIT" // "UNIT" or "BOOKING"
}
```

| Field                 | Definition                                                         |
| --------------------- | ------------------------------------------------------------------ |
| `defaultCurrency`     | The suppliers default currency.                                    |
| `availableCurrencies` | Other currencies that the the supplier accepts.                    |
| `pricingPer`          | How the supplier prices the requested product. (`UNIT`, `BOOKING`) |

`UNIT` means pricing is based on each unit as defined in the Product Object. Examples: day tours, transportation, attractions, any price per unit or age band.

`BOOKING` means pricing is the same regardless of number of units. Examples: charter bookings, group bookings, or ad-hoc pricing where it might be a fix price for the entire product.&#x20;

## Availability Calendar (Price Check)

<mark style="color:green;">`POST`</mark> `https://api.zaui.io/octo/suppliers/:sid/availability/calendar`

Adding pricing to the availability calendar check will return a final quote before reserving the inventory for a booking.

#### Request Body

| Name     | Type   | Description              |
| -------- | ------ | ------------------------ |
| currency | string | The ISO code for pricing |

{% tabs %}
{% tab title="200 " %}

```javascript

// If no Units are passed in

{
    // rest of the Availability response
    "unitPricingFrom": [
        {
            "unitId": "adults_0e064227-c793-426b-857c-2d1fcba62582",
            "original": 4500,
            "retail": 4500,
            "net": 3500,
            "currency": "USD",
            "currencyPrecision": 2,
            "includedTaxes": [
               {
                  "name": "VAT 10",
                  "retail": 800,
                  "net": 500
               }
            ]
        },
        {
            "unitId": "children_ea3b2ef2-a035-45d4-9a65-9f86b779f7df",
            "original": 4200,
            "retail": 4200,
            "net": 3200,
            "currency": "USD",
            "currencyPrecision": 2,
            "includedTaxes": [
                {
                   "name": "VAT 10",
                   "retail": 800,
                   "net": 500
                }
            ]
        }
    ]
}

// If Units are passed in

{
    // rest of the Availability response
    "unitPricingFrom": [
        {
            "unitId": "adults_0e064227-c793-426b-857c-2d1fcba62582",
            "original": 4500,
            "retail": 4500,
            "net": 3500,
            "currency": "USD",
            "currencyPrecision": 2,
            "includedTaxes": [
               {
                  "name": "VAT 10",
                  "retail": 800,
                  "net": 500
               }
            ]
        },
        {
            "unitId": "children_ea3b2ef2-a035-45d4-9a65-9f86b779f7df",
            "original": 4200,
            "retail": 4200,
            "net": 3200,
            "currency": "USD",
            "currencyPrecision": 2,
            "includedTaxes": [
               {
                  "name": "VAT 10",
                  "retail": 800,
                  "net": 500
               }
            ]
        }
    ],
    "pricingFrom":{ // Totals the unit price x units passed in to request
        "original": 4500,
        "retail": 4500,
        "net": 3500, 
        "currency": "USD",
        "currencyPrecision": 2,
        "includedTaxes": [
           {
              "name": "VAT 10",
              "retail": 800,
              "net": 500
           }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

## Availability pricing (Price Check)

<mark style="color:green;">`POST`</mark> `https://api.zaui.io/octo/suppliers/:sid/availability/`

Adding pricing to the availability check will return a final quote before reserving the inventory for a booking.

#### Request Body

| Name     | Type   | Description              |
| -------- | ------ | ------------------------ |
| currency | string | The ISO code for pricing |

{% tabs %}
{% tab title="200 " %}

```javascript

// If no Units are passed in

{
    // rest of the Availability response
    "unitPricing": [
        {
            "unitId": "adults_0e064227-c793-426b-857c-2d1fcba62582",
            "original": 4500,
            "retail": 4500,
            "net": 3500,
            "currency": "USD",
            "currencyPrecision": 2,
            "includedTaxes": [
               {
                  "name": "VAT 10",
                  "retail": 800,
                  "net": 500
               }
            ]
        },
        {
            "unitId": "children_ea3b2ef2-a035-45d4-9a65-9f86b779f7df",
            "original": 4200,
            "retail": 4200,
            "net": 3200,
            "currency": "USD",
            "currencyPrecision": 2,
            "includedTaxes": [
               {
                  "name": "VAT 10",
                  "retail": 800,
                  "net": 500
               }
            ]
        }
    ]
}

// If Units are passed in

{
    // rest of the Availability response
    "unitPricing": [
        {
            "unitId": "adults_0e064227-c793-426b-857c-2d1fcba62582",
            "original": 4500,
            "retail": 4500,
            "net": 3500,
            "currency": "USD",
            "currencyPrecision": 2,
            "includedTaxes": [
               {
                  "name": "VAT 10",
                  "retail": 800,
                  "net": 500
               }
            ]
        },
        {
            "unitId": "children_ea3b2ef2-a035-45d4-9a65-9f86b779f7df",
            "original": 4200,
            "retail": 4200,
            "net": 3200,
            "currency": "USD",
            "currencyPrecision": 2,
            "includedTaxes": [
               {
                  "name": "VAT 10",
                  "retail": 800,
                  "net": 500
               }
            ]
        }
    ],
    "pricing":{ // Totals the unit price x units passed in to request
        "original": 4500,
        "retail": 4500,
        "net": 3500, 
        "currency": "USD",
        "currencyPrecision": 2,
        "includedTaxes": [
           {
              "name": "VAT 10",
              "retail": 800,
              "net": 500
           }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Use the `/octo/suppliers/:id/availability/` call to perform simple price checks.
{% endhint %}

## Booking and pricing

<mark style="color:green;">`POST`</mark> `https://api.zaui.io/octo/suppliers/:sid/bookings`

The booking reservation call

#### Request Body

| Name     | Type   | Description                  |
| -------- | ------ | ---------------------------- |
| currency | string | The ISO currency for pricing |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  //..rest of booking schema
  "pricing": {
    "original": 4500,
    "retail": 4500,
    "net": 3500,
    "currency": "USD",
    "currencyPrecision": 2,
    "includedTaxes": [
       {
          "name": "VAT 10",
          "retail": 800,
          "net": 500
       }
    ]
  }
  //..rest of the booking schema
}
```

{% endtab %}
{% endtabs %}
