Skip to main content
An order in the MIOeSIM system represents a purchase of one or more SIM cards for a given plan. Each order has a unique order number, a lifecycle tracked via status codes, and a list of card records containing the activation details your customers need. Understanding the order structure lets you correctly handle fulfillment, renewals, cancellations, and reconciliation with your own platform.

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.
CodeNameDescription
-1UnpaidOrder created but payment not yet confirmed. Cards have not been allocated.
0Normal (paid)Order paid and active. Cards are allocated and activation codes are available.
2CancelledOrder cancelled before activation. A refund may have been issued.
3Obsolete / voidOrder is void and no longer valid.
4Partial unsubscribeSome cards in the order have been cancelled; others remain active.
5EndedAll plans on the order have expired or been fully used.
6Unsubscribing in processA cancellation request has been submitted and is being processed.
7Partial unsubscribe in processA partial cancellation is being processed for some cards in the order.
In a typical flow, an order transitions from -10 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.
FieldTypeDescription
orderNumStringUnique order number, e.g. "EP20240124000013".
displayStringProduct display name for the ordered SKU.
purchaseDateStringOrder creation timestamp (GMT+8).
countIntegerNumber of SIM cards in the order.
priceDoubleTotal cost of the order.
statusIntegerCurrent order status code. See Order lifecycle.
renewalBooleantrue if this order is a renewal of a previous plan.
renewInteger0 = this is a main order; 1 = this is a renewal order.
mainOrderNumStringThe parent order number this renewal is linked to. Present only when renew=1.
renewOrderNumArrayList of renewal order numbers associated with this order.
priceIdIntegerThe package price ID that was ordered.
cardApiDtoListArrayList of individual card records. See Card details.

Card details

Each entry in cardApiDtoList represents a single SIM card delivered by the order. For eSIM orders, this contains everything needed to activate the plan on a device.
FieldTypeDescription
iccidStringUnique card identifier. Use this to look up usage and manage the card.
mobileNumberStringPhone number assigned to the eSIM.
sm_dp_addressStringSM-DP+ server address, used to construct the QR code.
activationCodeStringActivation code for the eSIM profile.
codeStringFull LPA string for Android activation, formatted as LPA:1$<sm_dp_address>$<activationCode>.
activateBeforeStringDeadline by which the eSIM must be activated.
usedMBIntegerData consumed so far, in MB.
startDateStringPlan start date.
endDateStringPlan end date.
pdfUrlStringURL to a PDF containing the QR code, ready to send to your customer.
apnStringAPN setting the customer may need to configure on their device.
dpIdStringDistribution partner ID. Present on physical SIM orders.
dpStatusStringCard status. See Card status values.
eidStringeUICC identifier for the device the eSIM is installed on.
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=1 and a mainOrderNum pointing to the original order.
  • The original order has a renewOrderNum array listing all renewal orders placed against it.
  • The renewal boolean on the renewal order is true.
Use 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 the refundOrder 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 premark field of the package) must permit cancellation.
  • Some plans are non-refundable after purchase — check premark before presenting a cancel option.
When you cancel only some cards in a multi-card order, the order moves to status 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:
FieldDescription
otherOrderIdYour platform’s order identifier. Pass this when creating an order to tag it with your internal reference.
otherItemIdYour platform’s line-item identifier for a specific card within the order.
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.