Send flight tickets

To send a flight 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 flight ticket template parameters in the message payload.

To send a flight 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": "AIRLINE_TICKET",
          "templateParameters": {
            "merchantTicketId": "Merchant assigned ticket ID",
            "travelLegs": [
              {
                "flightInfo": {
                  "airlineName": "Airline operating this flight",
                  "flightNumber": "Flight number (AI347)"
                },
                "pnrNumber": "PNR for this flight leg",
                "departureAirport": {
                  "cityName": "Name of departure city",
                  "airportName": "Name of departure airport",
                  "airportCode": "Code for departure airport",
                  "terminal": "Departure terminal name"
                },
                "departureTime": "Departure time in RFC 3339 format(2017-02-15T10:50:30Z)",
                "arrivalAirport": {
                  "cityName": "Name of arrival city",
                  "airportName": "Name of arrival airport",
                  "airportCode": "Code for arrival airport",
                  "terminal": "Arrival terminal name"
                },
                "arrivalTime": "Departure time in RFC 3339 format (2017-02-15T10:50:30Z)",
                "passengers": [
                  {
                    "name": "Passenger's name",
                    "ageYears": 25,
                    "seatType": "Flight seat type (economy / business)",
                    "seatNumber": "Flight seat number (23A)"
                  },
                  {
                    "name": "Passenger's name",
                    "ageYears": 25,
                    "seatType": "Flight seat type (economy / business)",
                    "seatNumber": "Flight seat number (23A)"
                  }
                ]
              },
              {
                "flightInfo": {
                  "airlineName": "Airline operating this flight",
                  "flightNumber": "Flight number (AI347)"
                },
                "pnrNumber": "PNR for this flight leg",
                "departureAirport": {
                  "cityName": "Name of departure city",
                  "airportName": "Name of departure airport",
                  "airportCode": "Code for departure airport",
                  "terminal": "Departure terminal name"
                },
                "departureTime": "Departure time in RFC 3339 format(2017-02-15T10:50:30Z)",
                "arrivalAirport": {
                  "cityName": "Name of arrival city",
                  "airportName": "Name of arrival airport",
                  "airportCode": "Code for arrival airport",
                  "terminal": "Arrival terminal name"
                },
                "arrivalTime": "Arrival time in RFC 3339 format (2017-02-15T10:50:30Z)",
                "passengers": [
                  {
                    "name": "Passenger's name",
                    "ageYears": 25,
                    "seatType": "Flight seat type (economy / business)",
                    "seatNumber": "Flight seat number (23A)"
                  },
                  {
                    "name": "Passenger's name",
                    "ageYears": 25,
                    "seatType": "Flight seat type (economy / business)",
                    "seatNumber": "Flight 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 The ID provided by Google for a business. Required
vendorPaymentTransactionId String The 35-digit UPI transaction ID generated either by vendor (payment service provider) or merchant for every transaction. Required

Template type

You must pass the value for templateType object as FLIGHT_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, whether it's in the economy or business class in the flight. 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.

Flight info object

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

Parameters Type of value Description Required/Optional
airlineName String Name of the airline operating the flight. Required
flightNumber String The flight number. Required

Passenger name record (PNR) number

You must pass the PNR number generated for each flight leg in the pnrNumber key.

If the travel booking has connecting flights, define the key-value pairs such as airlineName, flightNumber, and pnrNumber for each flight in the travelLegs array as shown in the sample request.

Departure airport object

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

Parameters Type of value Description Required/Optional
cityName String Name of the departure city. Required
airportName String Name of the departure airport. Required
airportCode String Code of the departure airport. Optional
terminal String Terminal in the airport from where the flight departs. Optional
departureTime String Flight departure time. Required

Arrival airport object

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

Parameters Type of value Description Required/Optional
cityName String Name of the city where the flight will arrive. Required
airportName String Name of the airport where the flight will arrive. Required
airportCode String Code of the arrival airport. Optional
terminal String Terminal in the airport where the flight will arrive. Optional
arrivalTime String Flight arrival time. Required

Response

The API returns the following response if the request is successful:

{
  "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.