Purchase a quoted plan
purchaseBuy the plan in a quote and receive the eSIM. Use it after get_quote, before the quote expires and only when mandate_precheck allows it. Returns the order (status, and the eSIM delivery payload with the activation code or QR/LPA) and a signed receipt, and debits the principal's USD wallet. Example: {quote_id: "qt_...", idempotency_key: ""}. Details: it enforces the mandate and the wallet policy, holds the amount in the principal's wallet, orders from the supplier, debits the wallet, and returns the order with the eSIM delivery payload and a signed receipt. If the wallet is short, fails with WALLET_INSUFFICIENT_FUNDS and a ready top-up link for the principal. idempotency_key is required: reusing it returns the original order and never charges twice; while the original call is still running it answers ORDER_IN_PROGRESS (retryable, retry_after_seconds, order_id: repeat the same call later or poll order_status). QUOTE_PRICE_CHANGED (retryable): the plan's price went up since the quote (error.details.quoted_price and current_price); nothing was held or charged, get a new quote. If the supplier's answer is unknown (timeout, network error), the order stays "processing" with supplier_outcome "unknown" and the price held, not debited: poll order_status and do not buy again with a new key. Only SUPPLIER_FAILURE with retryable=true calls for a new quote and key. PRINCIPAL_FROZEN (not retryable): a top-up was reversed after its credit was spent, or the operator froze the principal; get_topup_link still works and the next credit settles the debt first.
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": {
"quote_id": "<quote_id>",
"idempotency_key": "<idempotency_key>"
},
"name": "purchase"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | No | Your agent id (or X-Agent-Id header) | |
| quote_id | Yes | quote_id from get_quote (quote.quote_id); one quote buys once and expires at quote.expires_at | |
| agent_key | No | Secret returned by register_agent (or X-Agent-Key header) | |
| principal_id | No | The principal you act for (or X-Principal-Id header) | |
| idempotency_key | Yes | Unique per purchase attempt, 8-128 characters, for example a UUID; repeat the same value only to retry that same attempt |