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. With a connected wallet it charges the wallet; with NO wallet it charges nothing and returns a checkout link for this exact plan that the user pays on pikasim.com.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"packageCode": "<packageCode>"
},
"name": "purchase_esim"
}
}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. | |
| payWith | No | Only matters when a wallet is connected. "wallet" (default) charges the wallet. "checkout" charges nothing and returns a checkout link for this exact plan, for a user who wants to pay by card or crypto themselves instead of from the wallet. | |
| 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. |