esimx402
Python client for the eSIMx402 production x402 API.
Buy travel eSIM data with a single HTTP request — no account, no API key. Pay on-chain in USDC or USDT (Polygon or TON). Built for AI agents and autonomous workflows.
Install
pip install esimx402
Quickstart
from esimx402 import Client
with Client() as client:
# 1. Discover plans for a country
plans = client.list_plans(country="JP")
cheap = min(plans, key=lambda p: p.price_usd)
# 2. Request an order — server returns 402 with the on-chain invoice
invoice = client.create_order(plan_id=cheap.id)
print(f"Pay {invoice.amount} {invoice.asset} on {invoice.chain} → {invoice.pay_to}")
# 3. Pay it. Bring your own wallet — any sender of ERC-20 transfers works.
your_wallet.send(
to=invoice.pay_to,
amount=invoice.amount,
chain=invoice.chain,
asset=invoice.asset,
)
# 4. Wait for the eSIM (5-15 s typical, 30 s ceiling)
esim = client.wait_for_esim(invoice.order_id)
print(esim.qr_image_url)
Async variant: from esimx402 import AsyncClient — same surface, all methods awaitable.
Three full examples
- examples/01_buy_esim.py — basic happy path
- examples/02_agent_failover.py — autonomous failover when the primary uplink dies
- examples/03_iot_geofence.py — IoT device crossing borders, no ops console
Errors
| Exception | When |
|---|---|
APIError |
Server returned an unexpected HTTP status (contract violation or outage) |
PaymentExpired |
The 402 invoice expired before payment landed on-chain |
OrderFailed |
Server received payment but couldn't fulfill the order. Automatic on-chain refund within 5 min |
TimeoutError |
wait_for_esim() ceiling reached without the order reaching DELIVERED |
Links
- API docs: https://esimx402.com/docs
- Quickstart: https://esimx402.com/quickstart
- Pricing: https://esimx402.com/pricing
- Issues / questions: https://github.com/timav12/esimx402/issues
- Email:
dev@esimx402.com
License
MIT
Metadata
Release files for esimx402 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| esimx402-0.1.0.tar.gz | 9.5 kB | Without provenance | Details for esimx402-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| esimx402-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for esimx402-0.1.0-py3-none-any.whl |
Total release size: 16.0 kB
Release files / esimx402-0.1.0.tar.gz
| Download URL | esimx402-0.1.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17cc8f93e46778414b8e6bab69144c9991ffcd943ecc8673b9cd03e4678a4fb2
|
|
BLAKE2b-256 checksum How to use checksums |
e7d2a63e9d13a65f18e921cd7196afbd4cbeb4659feb6a77e9bdd164db4aced0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / esimx402-0.1.0-py3-none-any.whl
| Download URL | esimx402-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6cef805f4bf961bc263225352b03c6a104fe429ecb2803b2a5c36050f92aacb2
|
|
BLAKE2b-256 checksum How to use checksums |
2eb07cd11e3068d16edb2306bd0a765343cdea028fade80e723f74f059f636d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for esimx402 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.