esimsCreateOrderWithHttpInfo method

Future<Response> esimsCreateOrderWithHttpInfo(
  1. String idempotencyKey, {
  2. EsimOrderRequest? esimOrderRequest,
  3. Future<void>? abortTrigger,
})

Order eSIMs

Places an order for new eSIMs or a top-up and returns the accepted order. Takes the same body as quote and needs the manage order permission (403 / 10003 without it). An Idempotency-Key header with a new UUID is required for every purchase: a retry with the same key and body returns the order already accepted, 202 / 12002 with Retry-After while it is still being accepted, and a changed body gives 409 / 12001. A top-up is an offer from search?iccid= ordered with inputs.iccid and quantity 1; without inputs.iccid the same offer is bought as a new eSIM. A new eSIM is instant unless inputs.isInstant is false, which delivers an entitlement to provision later. Every price is recalculated: a current price above inputs.maxPrice gives 409 / 11002 before anything is charged.

Note: This method returns the HTTP Response.

Parameters:

  • String idempotencyKey (required): UUID idempotency key for safe retries of this operation.

  • EsimOrderRequest esimOrderRequest:

Implementation

Future<Response> esimsCreateOrderWithHttpInfo(String idempotencyKey, { EsimOrderRequest? esimOrderRequest, Future<void>? abortTrigger, }) async {
  // ignore: prefer_const_declarations
  final path = r'/api/v1/b2b/esims/order';

  // ignore: prefer_final_locals
  Object? postBody = esimOrderRequest;

  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,
  );
}