Request Bus Booking

This API Endpoint makes a POST request to the Travu API service in other to make a BOOKING request to to the associated Bus operator based on the selected TRIP from the customer. This makes an actual ticket reservation for your customer, obviously after you must have collected payment.

ENDPOINT URL

REQUEST TYPE: POST

LIVE URL: https://api.travu.africa/api/v1/book_trip

TEST URL: https://api.travu.africa/test/api/v1/book_trip

Remember to Pass your Authorization Token for this request to go through, read about Authorization here.

BODY PAYLOAD

The Body Payload is as below (in a case where two bus seats are selected);

{
    "seat_numbers": "1,2",
    "amount_per_seat": "Original Amount per seat of that bus trip as returned in the TRIP DETAILS",
    "agent_email": "email of your mytripapi account",
    "passengers": [
        {
            "title": "Traveler's title eg. Mr",
            "name": "Traveler's fullname eg. Abiah Johnie",
            "age": "Traveler's age eg. 32",
            "sex": "Traveler's gender eg. Male",
            "phone": "Traveler's phone number eg. 09100000000",
            "email": "Traveler's email address eg. [email protected]",
            "blood": "Traveler's blood group",
            "next_of_kin": "Traveler's Next of Kin fullname eg. Benjamin Johnie",
            "next_of_kin_phone": "Traveler's Next of Kin phone number eg.09000000000",
            "is_primary": true (first passenger should be the primary traveler)
        },
        {
            "title": "Mr",
            "name": "Barnabas Johnnie",
            "age": "32",
            "sex": "Male",
            "phone": "09057568594",
            "email": "[email protected]",
            "blood": "Traveler's blood group",
            "next_of_kin": "Miracle Johnnie",
            "next_of_kin_phone": "08000000000",
            "is_primary": false (other travelers are not primary traveler)
        }
    ],
    "origin_id": "Get from the TRIP DETAILS if available eg. 1",
    "destination_id": "Get from the TRIP DETAILS if available eg. 63",
    "boarding_at": "Get from the TRIP DETAILS if available eg. 96855",
    "trip_id": "Get from the TRIP DETAILS if available eg. 96855",
    "trip_date": "Get from the TRIP DETAILS eg. 2021-07-04",
    "order_id": "Get from the TRIP DETAILS if available eg. 03410a4b",
    "provider": "This is the Bus Provider's short_name eg. GUO as available on the TRIP DETAILS"
}

Below is an actual request made and it's response.

Book Trip Request

POST https://api.travu.africa/api/v1/book_trip

This API Endpoint makes a POST request to the Travu API service in other to make a BOOKING request to to the associated Bus operator based on the selected TRIP from the customer. This makes an actual ticket reservation for your customer, obviously after you must have collected payment.

Request Body

Name
Type
Description

seat_numbers*

2

Departure State

amount_per_seat*

3000

Destination state

agent_email

2023-04-01

Intending date of travel

origin_id*

10

Sorting result by an order

destination_id*

23

boarding_at

33

trip_id

122322

trip_date*

2023-03-28

order_id

22

provider*

ABC

{
    "order_status": "confirmed",
    "order_id": "TS230327073926778303IYVP",
    "order_name": "Abijah Johnnie",
    "order_email": null,
    "phone_number": null,
    "order_amount": 3500,
    "trip_id": "294899",
    "origin_id": "10",
    "destination_id": "40",
    "order_ticket_date": "2023-03-27T02:09:27.000Z",
    "order_total_seat": 1,
    "order_seats": "2",
    "amount_per_seat": 3500,
    "order_number": "2202038",
    "vehicle_no": "2+1, Shuttle Service,AC, Non-Video (15 seats)",
    "narration": "CALABAR TO UYO",
    "departure_terminal": "CALABAR",
    "destination_terminal": "UYO",
    "seat_details": [
        {
            "fare": "3500.00",
            "title": "Mr",
            "age": "1",
            "sex": "M",
            "name": "Abijah Johnnie",
            "email": "[email protected]",
            "phone": "07057568594",
            "blood": "AB-",
            "next_of_kin": "Benjamin Johnnie",
            "next_of_kin_phone": "09000000000",
            "seat_number": "2"
        }
    ],
    "provider": "ABC"
}

RESPONSE

The Response for the above request should bring the BOOKED DETAILS/RECEIPT in the below format if successful;

{
    "order_status": "confirmed",
    "order_id": "49008",
    "order_name": "Abiah Johnie",
    "order_email": "[email protected]",
    "phone_number": "09100000000",
    "order_amount": 13000,
    "trip_id": "96855",
    "origin_id": "45",
    "destination_id": "63",
    "order_ticket_date": "2021-07-03",
    "order_total_seat": 2,
    "order_seats": "1,2",
    "amount_per_seat": "6500.00",
    "order_number": "03410a4b",
    "vehicle_no": "1st Bus (15)",
    "narration": "UMUAHIA TO LAGOS - AJAH",
    "departure_terminal": "UMUAHIA",
    "destination_terminal": "LAGOS - AJAH",
    "seat_details": [
        {
            "fare": "6500.00",
            "title": "Mr",
            "age": "32",
            "sex": "M",
            "name": "Abiah Johnie",
            "email": "[email protected]",
            "phone": "09100000000",
            "blood": "A+",
            "next_of_kin": "Benjamin Johnnie",
            "next_of_kin_phone": "09000000000",
            "seat_number": "1"
        },
        {
            "fare": "6500.00",
            "title": "Mr",
            "age": "32",
            "sex": "M",
            "name": "Barnabas Johnie",
            "email": "[email protected]",
            "phone": "09057568594",
            "blood": "A+",
            "next_of_kin": "Miracle Johnnie",
            "next_of_kin_phone": "03000000000",
            "seat_number": "2"
        }
    ],
    "provider": "GUO"
}

Always convert these response values (Strings and Integers) into Strings so as to always correspond as our responds might return those values in either form.

From this response, you'll notice that the first Traveler automatically gets the first seat, while the second passenger gets the second seat, it goes on in that order if more seats are selected.

The "status" of a transaction/booking could be confirmed, failed or canceled.

Reference to Authentication for possible authentication errors that might occur during this request.

Last updated