flightsCreateOrderWithHttpInfo method
- String idempotencyKey, {
- FlightOrderRequest? flightOrderRequest,
- Future<
void> ? abortTrigger,
Order flights
Places and pays for flight bookings, one fare per item. Takes the same body as quote, with inputs required. Requires an Idempotency-Key header (a new UUID per purchase) and an API key with order-manage permission. Repeating the same request with the same key returns the original order; while the first request is still running the response is 202. The order is paid from your wallet balance and ticketing completes asynchronously: track it with GET /orders/{id} or the order.fulfillment.updated webhook. publicId is a fare's publicId from search, or one that a quote returned. inputs.passengers lists every passenger of the fare exactly once, in passengerIndex order 1 to N, optionally with seats in selectedSeats; paid baggage and other services go in inputs.selectedServices. Seats and services are checked against the airline's current offer and seat map, and their prices are added to the item's price. Each item is priced again with the airline before payment, and the price is capped. With the optional inputs.maxPrice, in the order currency, a higher price for the item (the fare with its paid extras) gives 409 / 11002 at items[i].inputs.maxPrice. Without it, the fare may not cost more than the price returned with the publicId (409 / 11002 at items[i]), and the order must be in the currency of that price (400 / 11005 at items[i]). A publicId keeps that price: after 409 / 11002, quote again and order with the publicId the quote returns, or send inputs.maxPrice. Each item is checked completely before the next one, and the first failure names its item: an invalid input or missing inputs gives 400 / 10001 at its path under items[i], for example items[0].inputs.passengers[0].email; an unknown, expired or another partner's publicId 400 / 11004 at items[i]; an offer the airline no longer sells 409 / 11003 at items[i]. Nothing is created or charged when the order is refused.
Note: This method returns the HTTP Response.
Parameters:
-
String idempotencyKey (required): UUID idempotency key for safe retries of this operation.
-
FlightOrderRequest flightOrderRequest:
Implementation
Future<Response> flightsCreateOrderWithHttpInfo(String idempotencyKey, { FlightOrderRequest? flightOrderRequest, Future<void>? abortTrigger, }) async {
// ignore: prefer_const_declarations
final path = r'/api/v1/b2b/flights/order';
// ignore: prefer_final_locals
Object? postBody = flightOrderRequest;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
headerParams[r'Idempotency-Key'] = parameterToString(idempotencyKey);
const contentTypes = <String>['application/json', 'text/json', 'application/*+json'];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
abortTrigger: abortTrigger,
);
}