> For the complete documentation index, see [llms.txt](https://truq-services.gitbook.io/merchants/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://truq-services.gitbook.io/merchants/booking-management/trip-booking/getting-a-quote.md).

# Getting a Quote

A customer may choose to get a quote for the trip before proceeding to booking and confirming payment for the trip. The trip quote provides details and a breakdown of the cost of the trip. Therefore before your customers book a trip, they are allowed to see information about the cost of the trip. The trip quote is not considered a trip, therefore a trip is not initiated by the customer.&#x20;

### Collect trip information

The `trip_type`, `category_size`,  `scheduled_date`, `source`, and `destination` parameters are required to calculate a charge for a quote, they can be optional fields. We also collect `email`, `phone`,  `first_name`, and `last_name`  fields for the user, they are also optional fields.&#x20;

<pre class="language-url" data-title="Endpoint"><code class="lang-url"><strong>https://dodge-apis-c2btvqbhlq-uc.a.run.app/booking-service/booking/booking-trip/check_quote/
</strong>-H "Authorization: Bearer YOUR_PUBLIC_KEY"
-H "Organisation: YOUR_REFERENCE"
-X POST
</code></pre>

```
Request body
{
    "last_name": "doe",
    "phone": "2348113780934",
    "first_name": "john",
    "email": "user@gmail.com",
    "source": {
        "address": "ikeja",
        "longitude": 3.3717084,
        "latitude": 7.144144799999999,
        "city": "ABẸ́ÒKÚTA",
        "state": "Abẹ́òkúta"
    },
    "destination": {
        "address": "ibadan",
        "longitude": 5.8564864,
        "latitude": 6.927869299999999,
        "state": "ibadan",
        "city": "bodija",
        "stops": {
            "number": 0,
            "stopovers": [
                
            ]
        }
    },
    "extras": {
        "shrink_wraps": 2,
        "loaders": 4,
        "destination_storeys": 2,
        "source_storeys": 3
    },  
    "category_size": "7ad1f8c3-0368-47b2-8f9a-6150adc1ebff",
    "scheduled_date": "2023-08-10 10:00:06.755446+00:00",
    "estimated_value": "1000000",
    "trip_type": "INTRASTATE"
}
```

```
Response body
{
    "status": "SUCCESS",
    "message": "Successfully calculated quote",
    "data": {
        "id": "a7cc5239-xxxx-xxxx-8a8f-6f6e7c6d5e06",
        "organisation": "GAN_xxxx",
        "user": {
            "first_name": "",
            "last_name": "",
            "email": "user@gmail.com",
            "phone": "2348113780934"
        },
        "trip_type": "INTRASTATE",
        "source": {
            "address": "ikeja",
            "longitude": 3.3717084,
            "latitude": 7.144144799999999,
            "city": "ABẸ́ÒKÚTA",
            "state": "Abẹ́òkúta"
        },
        "destination": {
            "address": "ibadan",
            "longitude": 5.8564864,
            "latitude": 6.927869299999999,
            "state": "ibadan",
            "city": "bodija",
            "stops": {
                "number": 0,
                "stopovers": []
            }
        },
        "extras": {
            "shrink_wraps": 2,
            "loaders": 4,
        },
        "distance": 383.279,
        "quote": {
            "extras_charge": "100.00",
            "base_fare": "10000.00",
            "cost_per_kilometer": "114983.70",
            "vat_value": "9373.78",
            "shrink_wraps": "200",
            "loaders": "1200",
            "estimated_insurance": "2500",
            "charge": "138357.48",
            "total_charge": "138357.48",
            "insurance_premium": "2500",
            "organisation": "GAN_xxxx",
            "vat_type": "REV_VAT",
            "payment_option": "IMMEDIATE",
            "platform_commission_type": "percentage",
            "platform_commission_value": "20.0",
            "currency": "NGN",
            "reference": "TRP83xxxxxx",
            "saas_charge": "11608.53",
            "saas_vat": "870.64",
            "total_vat": "10244.42",
            "base_platform": "24996.74",
            "sub_total": "124983.70",
            "platform_fee": "12517.57"
        },
        "estimated_value": 1000000.0,
        "category_size": {
            "id": "80c44000-1d08-xxxx-xxxx-0c7dbabb1857",
            "organisation": "GAN_TFOH",
            "category": "SMALLES",
            "tonnage": "1.0"
        },
        "scheduled_date": "2023-08-10 10:00:06.755446+00:00"
    }
}
```

### Types of Quotes

There are three (3) types of quotes that can be initiated by a customer:

* Empty Quote: An empty quote is created when any of `trip_type`, `category_size`,  `scheduled_date`, `source`, and `destination` is treated as an optional field

```
Request body
{
    "last_name": "doe",
    "phone": "2348113780934",
    "first_name": "john",
    "email": "user@gmail.com",
    "scheduled_date": "2023-08-10 10:00:06.755446+00:00",
}
```

```
{
    "status": "SUCCESS",
    "message": "Successfully calculated quote",
    "data": {
        "id": "d7d8493b-82ae-xxxx-xxxx-85fce12f2ae4",
        "organisation": "GAN_xxxx,
        "organisation_booking_profile": "61cf79b0-xxxx-xxxx-bdcc-6ff9355466e2",
        "user": {
            "first_name": "john",
            "last_name": "doe",
            "email": "user@gmail.com",
            "phone": "2348113780934"
        },
        "reference": "GANTFOHH9B4Pxxxx",
        "business_tripset": {},
        "trip_type": null,
        "system_trip_type": "VARIABLE",
        "source": {},
        "destination": {},
        "extras": {},
        "distance": 0.0,
        "quote": {
            "reference": "TRPYBP3Jxxxx"
        },
        "estimated_value": 0.0,
        "category_size": {},
        "scheduled_date": "2023-08-10 10:00:06.755446+00:00"
    }
}
```

* Merchant Quote: A merchant quote is created when a merchant coupon is passed in the  `coupon` field. The quote also calculates and displays the discounted amount gotten from the discount code

```
Request body
{
    "last_name": "doe",
    "phone": "2348113780934",
    "first_name": "john",
    "email": "user@gmail.com",
    "coupon": "merchant_coupon",
    "source": {
        "address": "ikeja",
        "longitude": 3.3717084,
        "latitude": 7.144144799999999,
        "city": "ABẸ́ÒKÚTA",
        "state": "Abẹ́òkúta"
    },
    "destination": {
        "address": "ibadan",
        "longitude": 5.8564864,
        "latitude": 6.927869299999999,
        "state": "ibadan",
        "city": "bodija",
        "stops": {
            "number": 0,
            "stopovers": [
                
            ]
        }
    }, 
    "category_size": "7ad1f8c3-0368-47b2-8f9a-6150adc1ebff",
    "scheduled_date": "2023-08-10 10:00:06.755446+00:00",
    "estimated_value": "1000000",
    "trip_type": "INTRASTATE"
}
```

```
Response body
{
    "status": "SUCCESS",
    "message": "Successfully calculated quote",
    "data": {
        "id": "5ada1d27-26b9-xxxx-xxxx-2c805f9991a8",
        "organisation": "GAN_TFOH",
        "organisation_booking_profile": "61cf79b0-xxxx-xxxx-bdcc-6ff9355466e2",
        "reference": "GANTFOHU78B1QYIO",
        "user": {
            "first_name": "john",
            "last_name": "doe",
            "email": "user@gmail.com",
            "phone": "2348113780934"
        },
        "business_tripset": {
            "business": "BOR-xxxx",
            "business_id": "4bd151ec-xxxx-xxxx-9ca1-f0bb4f19cd39",
            "user": "3839aa59-6d26-xxxx-xxxx-4ee481ffd2a5",
            "account_manager": "None",
            "is_merchant": true
        },
        "coupon": {"key": "merchant_coupon_key", "code": "merchant_coupon_code"},
        "trip_type": "INTRASTATE",
        "source": {
            "address": "ikeja",
            "longitude": 3.3717084,
            "latitude": 7.144144799999999,
            "city": "ABẸ́ÒKÚTA",
            "state": "Abẹ́òkúta"
        },
        "destination": {
            "address": "ibadan",
            "longitude": 5.8564864,
            "latitude": 6.927869299999999,
            "state": "ibadan",
            "city": "bodija",
            "stops": {
                "number": 0,
                "stopovers": []
            }
        },
        "distance": 383.279,
        "quote": {
            "currency": "NGN",
            "charge": "4379.04",
            "vat_value": "36.25",
            "vat_type": "NET_VAT",
            "platform_commission_type": "percentage",
            "platform_commission_value": "10.00",
            "payment_option": "RECONCILIATION",
            "platform_fee": "15.71",
            "saas_charge": "434.95",
            "saas_vat": "32.62",
            "reference": "TRPRZQTK748L",
            "discount_amount": "490.00",
            "total_charge": "4869.04",
            "base_platform": "483.28",
            "base_fare": "4832.79",
            "total_vat": "68.87"
        },
        "estimated_value": 1000000.0,
        "category_size": {
            "id": "80c44000-xxxx-xxxx-9527-0c7dbabb1857",
            "organisation": "GAN_TFOH",
            "category": "SMALLES",
            "tonnage": "1.0"
        },
        "scheduled_date": "2023-08-10 10:00:06.755446+00:00"
    }
}
```

* Customer Quote: A customer quote is created when the quote is initiated without a merchant coupon code. A coupon code (not belonging to a merchant) can be applied, and the dicount is calculated and displayed
