How It Works
Secure eSIM purchases with USDC escrow protection on Base.
Overview
Our smart contract escrow system protects both buyers and sellers. When you purchase an eSIM, your USDC is held in escrow until you activate the eSIM on your device. If you don't activate within 7 days, your payment is automatically refunded.
Escrow Flow
The escrow smart contract manages the complete payment lifecycle:
User Escrow Contract Merchant
| | |
|--- Approve USDC ----------->| |
| | |
|--- Select Plan ------------>| |
| | |
| [holdPayment] | |
|--- USDC Locked ------------>| |
| | |
|<-- eSIM QR Code ------------| |
| | |
|--- Install & Activate ----->| |
| | |
| [settlePayment] | |
| |--- USDC Released ---------->|
| | |
--- OR if not activated within 7 days ---
| [refund] | |
|<-- USDC Returned -----------| |Smart Contract
The ESIMPayment contract manages escrows with the following key functions:
| Function | Description |
|---|---|
holdPayment | Lock USDC in escrow for an eSIM order |
settlePayment | Release funds to merchant (eSIM activated) |
refund | Return funds to user (after expiry) |
getEscrow | View escrow details (amount, state, expiry) |
Escrow States
| State | Description |
|---|---|
None (0) | No escrow exists for this eSIM ID |
Pending (1) | USDC locked, awaiting activation |
Settled (2) | eSIM activated, funds released to merchant |
Refunded (3) | Funds returned to user |
SafeERC20 for secure token transfers and ReentrancyGuard for protection against reentrancy attacks.User Journey
1. Connect Wallet
Click "Connect Wallet" to link your wallet via WalletConnect. Supports MetaMask, Coinbase Wallet, Rainbow, and other popular wallets.
2. Approve USDC
Approve the escrow contract to spend your USDC. This is a one-time approval per amount. You can set a specific amount or unlimited approval.
3. Complete Purchase
Confirm the purchase. The escrow contract transfers your USDC and locks it with a 7-day expiry. Your eSIM QR code appears immediately. No email required.
4. Save Your eSIM URL
Important: Bookmark or save your eSIM page URL. This is your only way to access your eSIM details, QR code, and data usage. We don't collect emails, so we can't send you a link.
5. Install eSIM
Scan the QR code with your phone camera or go to Settings → Cellular → Add eSIM. The eSIM will be ready to use once you reach your destination.
Third-Party Integration
External websites and apps can initiate eSIM purchases by using our Quote API to get pricing and contract details, then redirecting users to complete the transaction.
Integration Flow
usdcAmount to your user with plan details.esimqr.link/web3?package=US_1_7 to complete payment.Query Parameters
| Parameter | Type | Description |
|---|---|---|
packageCode* | string | Package slug (e.g., US_1_7) or API code |
periodNum | integer | Number of days for daily plans (optional) |
contractAddress and usdcAddress from the response if you want to build your own wallet integration instead of redirecting users.Refund Policy
The escrow contract enforces automatic refunds for unactivated eSIMs:
Automatic Refund
If you don't install your eSIM within 7 days, anyone can call the refund() function to return your USDC. We run an automated job to process expired escrows.
Manual Cancellation
Need to cancel before 7 days? Contact support and we can process an early refund via the forceRefund() function (owner-only).
Security
Network Configuration
| Network | Base Sepolia (testnet) |
| Chain ID | 84532 |
| USDC Token | 0x036CbD53842c5426634e7929541eC2318f3dCF7e |
| Escrow Contract | 0xf4cBAAF678F3Bb8e1Af20681121EE908E7B63235 |
| Escrow Duration | 7 days |
| USDC Decimals | 6 |