Send bus tickets

To send a bus ticket, you must first retrieve the transactionID of the user for whom you want to generate a ticket. Provide the transactionId for every transaction.

After getting the user transactionID, pass the bus ticket template parameters in the message payload.

To send a bus ticket to a user, make the following POST request to the API:

POST https://nbupayments.googleapis.com/v1/merchantCommunications:send
Content-type: application/json

{
  "merchantInfo": {
    "googleMerchantId": "Google assigned merchant ID"
  },
  "recipients": [
    {
      "vendorPaymentTransactionId": "35 digit UPI transaction ID"
    }
  ],
  "messagePayload": {
    "merchantMessageId": "Merchant created unique ID for every message",
    "components": [
      {
        "template": {
          "templateType": "BUS_TICKET",
          "templateParameters": {
            "merchantTicketId": "Merchant assigned ticket ID",
            "travelLegs": [
              {
                "busInfo": {
                  "operatorName": "Name of entity operating this bus",
                  "busNumber": "Bus number"
                },
                "pnrNumber": "PNR for this bus ticket",
                "departureStop": {
                  "cityName": "Name of departure city",
                  "stationName": "Name of departure bus station",
                  "stationAddress": {
                    "addressLine": [
                      "Address line 1",
                      "Address line 2"
                    ]
                  }
                },
                "departureTime": "Departure time in RFC 3339 format(2017-02-15T10:50:30Z)",
                "arrivalStop": {
                  "cityName": "Name of arrival city",
                  "stationName": "Name of arrival bus station",
                  "stationAddress": {
                    "addressLine": [
                      "Address line 1",
                      "Address line 2"
                    ]
                  }
                },
                "arrivalTime": "Arrival time in RFC 3339 format (2017-02-15T10:50:30Z)",
                "passengers": [
                  {
                    "name": "Passenger's name",
                    "ageYears": 25,
                    "seatType": "Bus seat type (sleeper / semi-sleeper)",
                    "seatNumber": "Bus seat number (23A)"
                  },
                  {
                    "name": "Passenger's name",
                    "ageYears": 25,
                    "seatType": "Bus seat type (sleeper / semi-sleeper)",
                    "seatNumber": "Bus seat number (23A)"
                  }
                ]
              }
            ]
          }
        }
      }
    ]
  }
}

Parameters

User and merchant

The following data parameters for the user object must be passed in the API request:

Parameters Type of value Description Required/Optional
googleMerchantID String ID provided by Google for a business. Required
googleTransactionId String ID provided by Google for every transaction using Google Pay. Required

Template type

You must pass the value for templateType object as BUS_TICKET. Pass the merchant created unique ID for every message in the merchantTicketId.

Passenger and seat

The following are the data parameters to pass into the passengers array:

Parameters Type of value Description Required/Optional
name String Name of the passenger. Required
age Number Age of the passenger. Optional
seatType String Type of seat - Sleeper/Push-back/AC/Non-AC. Required
seatNumber String Seat number allocated to the passenger. Required

If more than one passenger is traveling, define the key-value pairs such as name, ageYears, seatType,and seatNumber for each passenger in the passengers array as shown in the sample request.

Bus info object

The following are the data parameters to pass into the busInfo object:

Parameters Type of value Description Required/Optional
operatorName String Name of the agency or company operating the bus. Required
busNumber String The bus number. Required

PNR number

You must pass the PNR number generated for each bus ticket in the pnrNumber key.

If the travel booking has connecting buses, define key-value pairs operatorName, busNumber,and pnrNumber for each bus in the travelLegs array as shown in the sample request.

Departure stop object

The following are the data parameters to pass into the departureStop object:

Parameters Type of value Description Required/Optional
cityName String Name of the city from where the bus departs. Required
stationName String Name of the station from where the bus departs. Required
stationAddress String Address of the departure bus station. Optional
departureTime String Bus departure time. Required

Arrival stop object

The following are the data parameters to pass in the arrivalstop object.

Parameters Type of value Description Required/Optional
cityName String Name of the city where the bus arrives. Required
stationName String Name of the station where the bus arrives. Required
stationAddress String Address of the bus arrival station. Optional
arrivalTime String Bus arrival time. Required

Response

{
  "sendMessageResults": [
    {
      "recipient": {
        "vendorPaymentTransactionId": "35 digit UPI transaction ID"
      },
      "status": {
        "code": 200,
        "message": "Success response message"
      }
    }
  ]
}

The response contains the recipient googletransactionId, API response status, and the relevant message.