Order lifecycle
Orders move through a set of states identified by integer status codes. The table below describes each state and what it means for your integration.
In a typical flow, an order transitions from
-1 → 0 after payment, then to 5 when all plans expire. Orders that are cancelled move to 2 (fully cancelled) or 4/7 (partially cancelled).
Order structure
The order response contains metadata about the purchase as a whole. Use these fields to display order history, reconcile billing, and determine renewal eligibility.Card details
Each entry incardApiDtoList represents a single SIM card delivered by the order. For eSIM orders, this contains everything needed to activate the plan on a device.
Deliver the
code (LPA string) or pdfUrl to your end user so they can activate the eSIM. On iOS devices, users scan the QR code from the PDF. On Android, users can enter the LPA string directly.
Renewal orders
When a customer’s plan expires and they purchase a continuation, a new renewal order is created and linked to the original order.- The renewal order has
renew=1and amainOrderNumpointing to the original order. - The original order has a
renewOrderNumarray listing all renewal orders placed against it. - The
renewalboolean on the renewal order istrue.
mainOrderNum to trace a renewal back to its origin. Use renewOrderNum on the main order to enumerate all renewals and build a history view for your customers.
Only packages with
flowType=0 (renewable) support renewal orders. Check the package’s flowType before presenting a renewal option. See Renewability.Cancellation and unsubscribe
To cancel an order, call therefundOrder endpoint. The API cancels the order and, where eligible, processes a refund.
Cancellation is subject to the following conditions:
- The plan must not have been activated on a device.
- The plan’s cancellation policy (in the
premarkfield of the package) must permit cancellation. - Some plans are non-refundable after purchase — check
premarkbefore presenting a cancel option.
4 (partial unsubscribe) rather than 2 (fully cancelled). While a cancellation is being processed, the order will show status 6 or 7.
External order IDs
MIOeSIM supports two optional fields for mapping an order to your own platform’s records:
Pass these when calling
POST /api_esim/addEsimOrder. They are stored alongside the order and returned in subsequent queries, making it straightforward to reconcile MIOeSIM orders with your own database without maintaining a separate mapping table.