--- title: "Step 4: Send trip details to Flex Pay" slug: "step-4-send-trip-details-to-uplift" updated: 2025-06-05T07:17:04Z published: 2025-06-05T07:17:04Z canonical: "developer.upgrade.com/step-4-send-trip-details-to-uplift" --- > ## Documentation Index > Fetch the complete documentation index at: https://developer.upgrade.com/llms.txt > Use this file to discover all available pages before exploring further. # Step 4: Send trip details to Flex Pay ### Integration Details When on the payment page, before the agent can receive Flex Pay offers, we need to define a function that returns an TripInfo object that contains the order details to be sent to the Flex Pay platform for review. An example of creating such an object can be found below. Use the data schema that is most appropriate for your business. `function buildOrderInfo() {  return { travelers: [      {        "id": 0,        "first_name": "Arthur",        "last_name": "Davis",        "date_of_birth": "04/07/1963"      }    ], air_reservations: [      {        "airline_name": "AI",        "origin": "MIA",        "destination": "JFK",        "trip_type": "oneway",        "itinerary": [          {            "departure_apc": "MIA",            "departure_time": "20211223",            "arrival_apc": "JFK",            "arrival_time": "20211224",            "fare_class": "Economy",            "carrier_code": "NF"          }        ],        "insurance": [          {            "id": "0",            "types": ["cancellation"],            "price": 10000          }        ]      }    ], add_ons: [      {        "id": "0",        "name": "Priority Boarding",        "price": 5000      }    ], order_amount: 99900 //equivalent to $999.00 ⚠️ always use cents(integer)  }}` `function buildOrderInfo() {  return { travelers: [      {        "id": 0,        "first_name": "Arthur",        "last_name": "Davis",        "date_of_birth": "04/07/1963"      }    ], hotel_reservations: [      {        "hotel_name": "Snooze Inn",        "number_of_rooms": 1,        "room_type": "deluxe suite",        "check_in": "20211224",        "check_out": "20211225",        "insurance": [          {            "id": "0",            "types": ["cancellation"],            "price": 10000          }        ]      }    ], add_ons: [      {        "id": "0",        "name": "Priority Boarding",        "price": 5000      }    ], order_amount: 99900 //equivalent to $999.00 ⚠️ always use cents(integer)  }}` `function buildOrderInfo() {  return { travelers: [      {        "id": 0,        "first_name": "Arthur",        "last_name": "Davis",        "date_of_birth": "04/07/1963"      }    ], cruise_reservations: [      {        "cruise_line": "Wavy Cruise Lines",        "itinerary": [          {            "departure_port": "MIA",            "departure_date": "20211201",            "arrival_port": "FPO",            "arrival_date": "20211203"          }        ],        "ship_code": "WAV",        "rooms": [          {            "cabin_type": "Balcony",            "state_room_type": "Junior Suite"          }        ],        "embark_date": "20211205",        "disembark_date": "20211201",        "cruise_duration": 4,        "insurance": [          {            "id": "0",            "types": ["cancellation"],            "price": 10000          }        ]      }    ], add_ons: [      {        "id": "0",        "name": "Priority Boarding",        "price": 5000      }    ], order_amount: 99900 //equivalent to $999.00 ⚠️ always use cents(integer)  }}` `function buildOrderInfo() {  return { billing_contact: {      "first_name": "Arthur",      "last_name": "Davis",      "date_of_birth": "04/07/1963"    }, order_lines: [      {        "name": "Electric Guitar",        "sku": "1254865",        "quantity": 1,        "unit_price": 30000      }    ], order_amount: 99900 //equivalent to $999.00 ⚠️ always use cents(integer)  }}` `function buildOrderInfo() {  return { travelers: [      {        "id": 0,        "first_name": "Arthur",        "last_name": "Davis",        "date_of_birth": "04/07/1963"      }    ], event_tickets: [      {        "event_name": "Mayfield's Annual Music Festival",        "venue_name": "Events Park",        "unit_price": 15000,        "start_date": "20211201",        "end_date": "20211202",        "quantity": 1,        "insurance": [          {            "id": "0",            "types": ["cancellation"],            "price": 10000          }        ]      }    ], add_ons: [      {        "id": "0",        "name": "Priority Boarding",        "price": 5000      }    ], order_amount: 99900 //equivalent to $999.00 ⚠️ always use cents(integer)  }}` `function buildOrderInfo() {  return { travelers: [      {        "id": 0,        "first_name": "Arthur",        "last_name": "Davis",        "date_of_birth": "04/07/1963"      }    ], rentals: [      {        "type": "2021 Toyota Camry",        "unit_price": 1200000,        "quantity": 1,        "start_date": "20211205",        "end_date": "20211206",        "agency": "Car Rentals of Mayfield",         "pickup_location: {          "country": "US",          "region": "KY",          "city": "Mayfield",          "street_address": "1452 Rental Ave",          "postal_code": "99999"        },         "dropoff_location: {          "country": "US",          "region": "KY",          "city": "Mayfield",          "street_address": "1452 Rental Ave",          "postal_code": "99999"        },         "insurance": [          {            "id": "0",            "types": ["cancellation"],            "price": 10000          }        ]      }    ], add_ons: [      {        "id": "0",        "name": "Priority Boarding",        "price": 5000      }    ], order_amount: 99900 //equivalent to $999.00 ⚠️ always use cents(integer)  }}` 📘 Note that the order amount must be expressed in cents (integer). 📘 Refer to the full Order Object schema for all business verticals [here](/v1/docs/high-level-schema-overview) to learn about each attribute and ensure all mandatory field are populated. ### Creating a Trip Now that we have defined our TripInfo object, we will be creating a trip object with a tripId by sending this information to the Flex Pay platform as shown below. `// call createTrip after calling init()window.Uplift.Agent.createTrip(buildTripInfo()); ` ⚠️ Once the agent shares the offer with the client, a response will be generated in the callback handler defined in [step 3](/v1/docs/step-3-define-callback-handler), with the response object containing `tripId` as the identifier to differentiate between different trips. Make sure to **STORE** this as following methods will require this identifier. Update unsent offers📘 If the trip info changes and the offer hasn't been sent, a **new** **trip** must be created. New trips should only be created when necessary. ### Updating a Trip ⚠️ Only available when the offer is sentThe following method is exclusively applicable to trips for which an offer has already been sent to the customer. A trip object might require modifications after it has been created and sent to the customer, for example a customer changing their trip dates. In such a case, the following method should be used to update an existing trip object. `window.Uplift.Agent.updateTrip(  tripId: String,     // the Uplift tripId persisted by your system (required)  tripInfo: Object,   // the tripInfo object (required));` 📘 Some important things to note are: - Every time there is a change in the `tripInfo`, the updated information should be sent to Flex Pay using `window.Uplift.Agent.createTrip` or `window.Uplift.Agent.updateTrip` depending on if it’s a new trip or updating existing trip. - `window.Uplift.Agent.createTrip` will not send any traveler details on network requests unless an offer has been sent. - `window.Uplift.Agent.updateTrip` will need to send full `tripInfo` once an offer is sent to sync the iFrame (Flex Pay Application Modal) in real-time. ⚠️ Note that we will add more elements to this function in the following steps and additional components to enable this integration (and if you test at this point, it may result in an error due to missing components mentioned in following steps).