Recalculate
Re-prices a chosen trip and fare for specific passengers — for example, to apply per-passenger discounts before creating an order. Returns the per-passenger price breakdown.
Endpoint
Method: POST
URL: /v1/recalculate
Request Headers
| Parameter | Type | Required | Description |
|---|---|---|---|
| Authorization | String | Yes | Bearer <token> from Login |
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| └ trip_id | String | Yes | Trip id from a Search / Trip Details result |
| └ fare_class | String | No | Chosen fare class |
| └ currency | String | No | Requested pricing currency |
| └ passengers | [Object] | Yes | Passengers to price |
| └ index | Integer | No | Passenger position |
| └ type | String | No | Passenger type, refer to Passenger Types |
| └ discount_id | String | No | Chosen discount id (from Trip Details) |
| └ discount_code | String | No | Chosen discount code |
Request Example
json
{
"trip_id": "trip_8f21",
"fare_class": "adult",
"currency": "UAH",
"passengers": [
{ "index": 0, "type": "adult" },
{ "index": 1, "type": "adult" },
{ "index": 2, "type": "child", "discount_id": "d_child", "discount_code": "child" }
]
}Response Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| └ currency | String | Yes | Currency of the returned prices |
| └ passengers | [Object] | Yes | Per-passenger price breakdown |
| └ index | Integer | No | Passenger position (echo of request) |
| └ type | String | No | Passenger type |
| └ price | Number | No | Price for this passenger |
| └ currency | String | No | Currency for this passenger |
| └ discount_id | String | No | Applied discount id |
| └ discount_code | String | No | Applied discount code |
| └ discount_percent | Number | No | Applied discount percentage |
Response Example
json
{
"currency": "UAH",
"passengers": [
{ "index": 0, "type": "adult", "price": 650.0, "currency": "UAH" },
{ "index": 1, "type": "adult", "price": 650.0, "currency": "UAH" },
{ "index": 2, "type": "child", "price": 325.0, "currency": "UAH", "discount_id": "d_child", "discount_code": "child", "discount_percent": 50 }
]
}Error Code List
| code | message | Description |
|---|---|---|
| UNAUTHORIZED | Invalid token | The bearer token is missing, invalid, or expired (401). |
| NOT_FOUND | Trip not found | The trip_id is unknown or has expired. |