DEV Community

Travel Terminus
Travel Terminus

Posted on

Building a Policy Aware Flight Booking Flow for Corporate Travel (B2E): A Developer's Guide


Most flight booking tutorials assume one simple journey: a traveller searches, pays and receives a ticket. Corporate travel breaks that model. The person booking is an employee, the company pays, a manager may need to approve, and finance needs every trip tagged to a cost centre.

If you are adding flight booking to an HRMS, ERP, intranet or employee app, the hard part is not the search call. It is everything around it.

This guide walks through the architecture of a policy aware B2E (business to employee) booking flow, with code you can adapt.

Field names and endpoints below are illustrative. Every flight API provider structures responses differently, so map them to your provider's documentation.

B2C vs B2E: what actually changes

B2C (OTA) B2E (Corporate)
Who pays Traveller Company
Pricing Markup on fare Corporate, SME, published and flexi fares
Extra step None Policy check and approval
Output Ticket and invoice Ticket plus cost centre data for ERP
Success metric Conversion Compliance, booking time, spend visibility

The flow at a glance

Employee searches
      |
      v
Search API -> Normalise offers -> Evaluate policy per offer
                                        |
                  +---------------------+---------------------+
                  |                                           |
             In policy                                  Out of policy
                  |                                           |
      Reprice -> Book -> Ticket                  Reprice -> Book (hold, no ticket)
                  |                                           |
                  |                                   Manager approval
                  |                                  /               \
                  |                     Approved: reprice,      Rejected:
                  |                     re-check, ticket        cancel hold
                  |                                  \               /
                  +--------------> Push trip data to ERP / expense tool
Enter fullscreen mode Exit fullscreen mode

Step 1: Model the travel policy as data

Hard coded rules work until HR changes them. Store policy as data, per company or employee grade.

{
  "policyId": "grade-b",
  "maxCabin": "ECONOMY",
  "allowPremiumAboveMinutes": 360,
  "maxFareByRoute": { "DEL-BOM": 9000, "BLR-DXB": 32000 },
  "defaultMaxFare": 25000,
  "minAdvanceDays": 7,
  "preferredFareTypes": ["CORPORATE", "SME"],
  "currency": "INR"
}
Enter fullscreen mode Exit fullscreen mode

Step 2: Evaluate every offer, don't hide them

A common mistake is filtering out of policy flights entirely. Employees then think the tool is broken and book somewhere else. Show every offer, mark the ones outside policy, and explain why.

const CABIN_RANK = { ECONOMY: 1, PREMIUM_ECONOMY: 2, BUSINESS: 3, FIRST: 4 };

function evaluatePolicy(offer, policy, now = new Date()) {
  const reasons = [];

  const longFlight = offer.durationMinutes >= policy.allowPremiumAboveMinutes;
  const allowedCabin = longFlight ? 'PREMIUM_ECONOMY' : policy.maxCabin;
  if (CABIN_RANK[offer.cabin] > CABIN_RANK[allowedCabin]) {
    reasons.push(`Cabin ${offer.cabin} is above allowed ${allowedCabin}`);
  }

  const route = `${offer.origin}-${offer.destination}`;
  const cap = policy.maxFareByRoute[route] ?? policy.defaultMaxFare;
  if (offer.totalFare > cap) {
    reasons.push(`Fare ${offer.totalFare} exceeds cap ${cap}`);
  }

  const daysAhead = Math.floor((new Date(offer.departureTime) - now) / 86_400_000);
  if (daysAhead < policy.minAdvanceDays) {
    reasons.push(`Booked ${daysAhead} days ahead, policy asks for ${policy.minAdvanceDays}`);
  }

  return {
    inPolicy: reasons.length === 0,
    preferred: policy.preferredFareTypes.includes(offer.fareType),
    reasons
  };
}
Enter fullscreen mode Exit fullscreen mode

Then sort so the cheapest in policy, preferred fare appears first:

offers
  .map(o => ({ ...o, policy: evaluatePolicy(o, policy) }))
  .sort((a, b) =>
    (b.policy.inPolicy - a.policy.inPolicy) ||
    (b.policy.preferred - a.policy.preferred) ||
    (a.totalFare - b.totalFare)
  );
Enter fullscreen mode Exit fullscreen mode

Step 3: Reprice twice

Fares change between search and booking. Corporate flows add a second gap: the time between booking and approval. Reprice before booking, and again before ticketing.

async function confirmPrice(api, offer, policy) {
  const priced = await api.reprice({ offerId: offer.id });
  const changed = priced.totalFare !== offer.totalFare;

  // A fare that was in policy at search time may not be anymore
  const check = evaluatePolicy({ ...offer, totalFare: priced.totalFare }, policy);
  return { priced, changed, check };
}
Enter fullscreen mode Exit fullscreen mode

Step 4: Hold, approve, then ticket

For out of policy trips, create the booking (PNR) without issuing the ticket, then request approval. The approval must finish before the airline's ticketing time limit.

async function bookWithApproval(api, offer, traveller, trip) {
  const booking = await api.book(
    { offerId: offer.id, passengers: [traveller], issueTicket: false },
    { idempotencyKey: trip.requestId } // retries and double clicks won't create two PNRs
  );

  await approvals.create({
    tripId: trip.id,
    approverId: traveller.managerId ?? trip.fallbackApproverId,
    reasons: offer.policy.reasons,
    expiresAt: booking.ticketingTimeLimit
  });

  return booking;
}
Enter fullscreen mode Exit fullscreen mode

A few rules that save a lot of support tickets:

  • Expire the approval request before the ticketing time limit, and cancel the hold automatically if nobody responds.
  • Send approval requests where managers already work: email, Microsoft Teams or Slack, with Approve and Reject buttons.
  • On approval, reprice and re-check policy before ticketing. If the fare went up past the cap, ask again instead of ticketing silently.

Step 5: Send trip data to finance

Every ticketed trip should produce a record your ERP or expense tool can consume directly.

{
  "tripId": "TRP-10482",
  "employeeId": "E2291",
  "costCentre": "SALES-WEST",
  "projectCode": "PRJ-118",
  "pnr": "ABC123",
  "fareType": "CORPORATE",
  "totalFare": 18450,
  "currency": "INR",
  "inPolicy": false,
  "approvedBy": "M104",
  "outOfPolicyReasons": ["Booked 3 days ahead, policy asks for 7"]
}
Enter fullscreen mode Exit fullscreen mode

Push it through a webhook or queue. The outOfPolicyReasons field is what makes quarterly travel reviews useful: finance can see not just how much was spent, but why trips went outside policy.

Step 6: Treat servicing as part of the flow

Date changes, cancellations and refunds follow the same logic. A date change is a new fare: reprice it, run the policy check, request approval if needed, then reissue. Refunds should update the finance record through the same webhook so spend reports stay accurate.

Edge cases worth testing

  • Price changes between approval and ticketing
  • Approval arriving after the ticketing time limit
  • Manager missing or on leave (fallback approver)
  • Multi city trips where only one leg breaks policy
  • The same trip booked twice by an employee and an assistant
  • Different currencies for international offices

Build or integrate?

Building direct GDS, NDC and low cost carrier connections, plus corporate and SME fare content, is a large project on its own. Most teams integrate a provider that already aggregates content and exposes search, reprice, book, ticket and servicing, then spend their own engineering time on policy, approvals and finance integration. That is where corporate value actually lives.

If you are evaluating options, this corporate travel flight API shows one approach: corporate, SME, flexi and NDC fares with booking embedded inside ERP, HRMS, expense tools, intranets, Teams and Slack. For basic request examples, see this sample repository.

Wrapping up

A good B2E booking flow is not about a prettier search page. It is about making the policy compliant option the fastest option: show every fare with clear reasons, reprice at every gap, approve where managers already work, and send clean data to finance automatically.

What does your approval flow look like? I'd like to hear how other teams handle ticketing time limits in the comments.

Disclosure: I work with the Travel Terminus team.

Top comments (0)