When travelers purchase a prepaid data eSIM right before boarding a flight, scanning a QR code on the same phone they are using to buy the plan is a notorious UX bottleneck. You can't easily point a phone's camera at its own screen.
While building the web provisioning flow for OpenSim, we had to solve two engineering problems:
- Generating reliable, offline-ready GSMA-compliant eSIM QR codes on the fly.
- Supporting one-tap direct installation on iOS (17.4+) and modern Android devices without requiring a second screen or manual SM-DP+ copy-pasting.
Here is how the architecture works under the hood.
1. Understanding the GSMA LPA Activation String
Every consumer eSIM profile boils down to a standardized string defined by the GSMA RSP (Remote SIM Provisioning) specification. It follows the LPA: URI scheme:
LPA:1$<SM-DP+_ADDRESS>$<ACTIVATION_CODE> -
1: Format version identifier. -
<SM-DP+_ADDRESS>: The FQDN of the Subscription Manager Data Preparation server (e.g.,rsp.truphone.comorsmdp.io). -
<ACTIVATION_CODE>: The unique matching ID generated when our backend reserves an ICCID from the upstream carrier API.
If an optional confirmation code is required by the carrier profile, a fourth segment ($<CONFIRMATION_CODE>) is appended, though most modern travel eSIM profiles omit this to avoid user drop-off.
2. Generating Resilient QR Codes Client-Side
Instead of generating PNGs on our backend and dealing with S3/CDN caching for sensitive, single-use activation tokens, we render the QR code directly in the browser from the provisioned lpaString.
Two details matter in production:
- Error Correction Level
Mor `Q: Travelers frequently scan QR codes off cracked laptop screens or dimmed airport displays. Using LevelM` (15% recovery) keeps the QR matrix dense enough to scan quickly while tolerating glare. - Quiet Zone Padding: Mobile OS camera parsers fail silently if a dark-mode UI bleeds into the QR border. Always enforce a hard
#FFFFFFbackground with at least a 4-module margin.
import QRCode from 'qrcode'; export async function renderEsimQr(lpaString, canvasElement) { if (!lpaString.startsWith('LPA:1$')) { throw new Error('Invalid GSMA LPA activation string'); } await QRCode.toCanvas(canvasElement, lpaString, { width: 260, margin: 4, errorCorrectionLevel: 'M', color: { dark: '#0f172a', light: '#ffffff', }, }); } 3. One-Tap Direct Install via Apple Universal Links (iOS 17.4+)
Starting in iOS 17.4, Apple introduced a native Universal Link endpoint that launches the system Cellular Plan Setup sheet directly from Safari—no QR scan or manual entry needed:
https://esimsetup.apple.com/esim_qrcode_provisioning?carddata=LPA:1$smdp.example.com$MATCHING-ID Because LPA: strings contain $ delimiters, passing the carddata parameter safely requires strict URI component encoding, plus a clean fallback for desktop browsers or older OS versions where the Universal Link simply redirects to an Apple support page.
export function buildDirectInstallUrl(lpaString, userAgent) { const isIOS = /iPad|iPhone|iPod/.test(userAgent); const encodedLpa = encodeURIComponent(lpaString); if (isIOS) { return `https://esimsetup.apple.com/esim_qrcode_provisioning?carddata=${encodedLpa}`; } // Fallback for manual copy / QR display return null; } In the UI, we parse the lpaString into its two human-readable parts (smDpAddress and activationCode) behind a collapsible "Manual Setup" accordion so users on older Android builds can still copy both fields with a single click.
4. Handling Provisioning States & Idempotency
Upstream telco APIs can take anywhere from 800ms to 6 seconds to allocate an ICCID and return the SM-DP+ matching ID. To prevent duplicate eSIM allocations when a user refreshes the page on spotty airport Wi-Fi:
- Idempotency Keys: Every order fulfillment request uses the order UUID as an idempotency key so retries return the already-allocated
ICCIDandLPAstring rather than minting a second profile. - State Machine: Our fulfillment table tracks
PENDING->PROVISIONED->INSTALLED(updated via carrier SM-DP+ callback webhooks when the profile is downloaded onto the device).
Key Takeaways
- Keep
LPA:1$strings client-rendered on authenticated order pages rather than storing static QR image URLs. - Always provide three paths on the activation screen: One-Tap Universal Link (iOS 17.4+), high-contrast QR code (laptop/second-device scan), and one-click copyable SM-DP+ + Activation Code fields.
- Make carrier allocation endpoints strictly idempotent—flaky travel connections guarantee double-clicks and page reloads.

