Docs
Get an API key

Pay for a flight with LiteAPI

Pay through LiteAPI checkout, complete your booking and recover an interrupted session.

In short

1 callFor people and agents
  1. 1POST/v1/flight/bookings/{id}/bookBook: pay and ticket

The same list heads this page's Markdown:/flight/flight-liteapi-checkout.md

You pay through LiteAPI checkout when your offer names LITEAPI. LiteAPI collects the traveller's payment and handles any refund. You cannot use a saved OEX instrument or add paid bags or seats to this booking, because those operations use a different payment flow.

Select the checkout provider

Send supplier: "LITEAPI" when you request offers, then prebook the selected offer_reference with your contact, passengers and use_payment_sdk: true. Keep the booking id and your idempotency key so you can resume the same checkout.

Read meta.payment_sdk.provider before loading a payment form:

ProviderYour checkout initialization
oexPass token to the OEX Payment SDK. You receive it on a fresh SDK prebook only; an OEX replay has no token.
liteapiPass token as secretKey and environment as publicKey to LiteAPIPayment. You may receive this metadata on a fresh prebook or a validated replay while ready to book.
{ "meta": { "payment_sdk": { "provider": "liteapi", "token": "<checkout secret>", "environment": "sandbox" } } }

Keep the token in memory only. Do not put it in logs, analytics, storage or URLs, because it grants access to checkout. You never receive it from get, list or book.

Show the LiteAPI payment form

Load the LiteAPI payment wrapper and mount it after your target element exists:

<div id="flight-payment"></div>
<script src="https://payment-wrapper.liteapi.travel/dist/liteAPIPayment.js?v=a1"></script>
// prebookResponse is the response from your backend's Flight prebook call.
const sdk = prebookResponse.meta.payment_sdk;
if (sdk.provider !== "liteapi") throw new Error("Use the OEX checkout flow");
const returnUrl = new URL("/flight-checkout/return", window.location.origin);
returnUrl.searchParams.set("booking_id", prebookResponse.data.id);
const checkout = new LiteAPIPayment({
  publicKey: sdk.environment,
  secretKey: sdk.token,
  returnUrl: returnUrl.toString(),
  targetElement: "#flight-payment",
});
checkout.handlePayment();

Use the returned environment unchanged so the form matches the intent. You do not need a LiteAPI API key in the browser. For a sandbox checkout, use 4242 4242 4242 4242, a future expiry and any three-digit security code.

Complete the flight booking

After the redirect, send the booking id to your authenticated backend and call POST /v1/flight/bookings/{id}/book with {}. Omit payment_instrument_id, because LiteAPI owns this payment. You do not send supplier transaction ids; Flight retained the matching references at prebook.

Treat the redirect as the point to request booking, not as ticket confirmation. Show a ticket only once your booking is CONFIRMED. Book returns 202 with COMPLETE_IN_PROGRESS while LiteAPI is still ticketing; once LiteAPI confirms, you receive flight.booking.confirmed and a read of the booking shows CONFIRMED. If it stays COMPLETE_IN_PROGRESS, contact support with your booking id instead of booking again. The LiteAPI flight prebook reference describes creation of the payment intent, and the flight booking reference describes completion using that intent.

Resume or investigate

Replay prebook with the same key while READY_FOR_COMPLETE to recover checkout metadata. You receive the secret only after the supplier prebook id, transaction id, price and currency match the stored booking and payment. A mismatch returns 500 result_unknown without a secret.

If you see PREBOOK_IN_PROGRESS, re-read the same booking and contact support before starting another checkout, because the supplier may have created an airline hold. If book returns result_unknown, follow Retry flight calls safely. Keep the original booking id and wait for support to confirm the next action before sending another book request, because the supplier may already have issued the ticket.

Do not start a new checkout solely because expires_at passed or a booking failed: your traveller may already have paid. Contact support with the booking and request ids to resolve payment and ticket status. A prebook that failed as passenger_name_rejected or offer_expired never reached checkout: prebook again with the real name, or a new search's offer, and a new key.

Your booking's payments shows the checkout payment with collected_by: "SUPPLIER" and no payment_method, because the card stays with LiteAPI.

After cancellation, use cancellation.refunded_by to identify the merchant responsible for returning money. SUPPLIER means LiteAPI handles it, and cancellation.refund_to names the checkout payment, because LiteAPI refunds the card it charged. A missing refund_amount needs investigation; zero means no refund is due, and a stated amount does not confirm settlement.

If your cancellation completed after a pending or interrupted response, the recovery read can establish cancellation status only. You cannot recover missing final fee or refund amounts through that read; contact support because a cancellation quote is not final refund evidence. You need support investigation for missing final amounts.

Keep learning

On this page

Endpoints on this page

POSTbookFlight