purchase_esim
Purchase a DATA eSIM. Deducts from your prepaid agent wallet and returns order details with activation info (ICCID, QR code, SM-DP+). Use the packageCode from search_esim_packages. For a daily-reset "Unlimited" plan, also pass days (the number of days to buy). For phone-number eSIMs use purchase_phone_plan instead. Requires an agent-wallet API key (ak_live_).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | ONLY for daily-reset "Unlimited" plans (get_package_details shows "Type: Daily unlimited"): the number of days to purchase. Valid values: 3, 5, 7, 10, 15, 30. Required for those plans, and the total charged is the per-day price times this many days (minus a duration discount). Omit for fixed-data plans. | |
| promoCode | No | Optional promo/discount code. Validated server-side; an invalid code rejects the order with the reason (nothing is charged). Only pass a code the user explicitly provided. | |
| requestId | No | Idempotency key: generate a fresh UUID for each NEW purchase, and reuse the SAME value when retrying after a timeout or transport error — an identical retry returns the original order instead of charging again. | |
| packageCode | Yes | The data-eSIM package code shown in [brackets] by search_esim_packages or get_package_details (e.g. P6ZMSDS1G). Phone-plan codes are not valid here; use purchase_phone_plan for those. |