Cryptonly verifies and settles each payment, and pays the network fee. Payments go straight to your wallet. This package plugs Cryptonly into the stock x402 middleware for FastAPI and Flask.
You need a Cryptonly API key with the x402.verify and x402.settle scopes. The quickstart covers getting one.
FastAPI
pip install cryptonly-x402 "x402[fastapi,evm]" fastapi uvicorn
import os
from cryptonly_x402 import CryptonlyFacilitatorClient
from fastapi import FastAPI
from x402.http import PaymentOption, RouteConfig
from x402.http.middleware.fastapi import PaymentMiddlewareASGI
from x402.mechanisms.evm.exact import ExactEvmServerScheme
from x402.server import x402ResourceServer
facilitator = CryptonlyFacilitatorClient(os.environ["CRYPTONLY_API_KEY"])
server = x402ResourceServer(facilitator)
server.register("eip155:8453", ExactEvmServerScheme())
routes = {
"GET /weather/:city": RouteConfig(
accepts=PaymentOption(scheme="exact", price="$0.01", network="eip155:8453", pay_to=os.environ["PAY_TO"]),
),
}
app = FastAPI()
app.add_middleware(PaymentMiddlewareASGI, routes=routes, server=server)
@app.get("/weather/{city}")
async def weather(city: str):
return {"city": city, "temperatureC": 21}
PAY_TO must be a wallet you added in the dashboard.
Flask
Install x402[flask,evm] and use the sync classes:
import os
from cryptonly_x402 import CryptonlyFacilitatorClientSync
from x402.mechanisms.evm.exact import ExactEvmServerScheme
from x402.server import x402ResourceServerSync
facilitator = CryptonlyFacilitatorClientSync(os.environ["CRYPTONLY_API_KEY"])
server = x402ResourceServerSync(facilitator)
server.register("eip155:8453", ExactEvmServerScheme())
Sandbox
Pass sandbox=True and use a key from your sandbox account. The sandbox settles on Base Sepolia (eip155:84532) and Solana Devnet.
facilitator = CryptonlyFacilitatorClient(os.environ["CRYPTONLY_API_KEY"], sandbox=True)
Learn more
- Prices in your code: Python, Express and Go examples
- Discovery: list your endpoints for AI agents
- Reference: key scopes, limits and reason codes
License
Metadata
Release files for cryptonly-x402 0.1.2
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 | |
|---|---|---|---|---|
| cryptonly_x402-0.1.2.tar.gz | 3.9 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cryptonly_x402-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / cryptonly_x402-0.1.2.tar.gz
| Download URL | cryptonly_x402-0.1.2.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef1966ab1e1c60adc962515a437e10863537c783ed63fd66fe7e02b195ddfc95
|
|
BLAKE2b-256 checksum How to use checksums |
a5b545ef1586651a3e4aa08ae8cf12b9e1cddd7d5037f80174dd498e9e779f31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.
Transparency logRelease files / cryptonly_x402-0.1.2-py3-none-any.whl
| Download URL | cryptonly_x402-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd3989ac9aa066734103c692f32d81fc681f0eab6def04be31161484e55ea0fa
|
|
BLAKE2b-256 checksum How to use checksums |
a835ce102dc840fdffb3dba89f114ac8b744367c6e437babf1b3c695d003155a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.
Transparency logSecurity for cryptonly-x402 0.1.2
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for cryptonly_x402-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.
Transparency logA 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.