Lydira API
TR

Booking guides

Flight booking

Your website sells flights on the agency's own supplier connections: search, price, hold, take the payment on your own POS, ticket.

The steps

  1. 1SearchPOST/api/v1/flights/search
  2. 2Wait for the answerGET/api/v1/flights/operations/{id}
  3. 3Price the offerPOST/api/v1/flights/price
  4. 4Hold itPOST/api/v1/flights/holds
  5. 5Take the payment, then ticketPOST/api/v1/flights/holds/{id}/ticket
  6. 6Release an unpaid holdDELETE/api/v1/flights/holds/{id}
  7. 7Buy a fare that cannot be heldPOST/api/v1/flights/purchases
  8. 8Read it backGET/api/v1/flights/bookings/{id}

The flow at a glance

  1. POST /api/v1/flights/search → choose an offer.
  2. Every call here except the read-back answers 202 (a cached search answers 200): read GET /api/v1/flights/operations/{id} until it answers.
  3. POST /api/v1/flights/price → show the total; keep the token.
  4. holdable: POST /api/v1/flights/holds → charge your POS → POST /api/v1/flights/holds/{id}/ticket, or DELETE /api/v1/flights/holds/{id} if unpaid.
  5. Not holdable: charge your POS → POST /api/v1/flights/purchases.
  6. GET /api/v1/flights/bookings/{id} or the ticket webhook for the numbers.

When the price moves

A fare can move between price and purchase. The call answers 409 price_changed with no figure: price the offer again, show the new total, and send the new token with a new Idempotency-Key. At ticketing time the hold stays open, so you can release it and start over.
409 approval_required means the agency approves this ticket in Lydira first. Give the key a role with no ticketing approval threshold and it never happens.