Toolkit Reference
@PaidEndpoint
Wraps any async FastAPI endpoint with x402 payment logic.
python
@PaidEndpoint(
price="0.5 HBAR",
receiver="0.0.4820193", # optional, defaults to HEDERA_ACCOUNT_ID
ttl_seconds=600, # optional
)
async def my_service(request: Request):
...The decorator:
- Intercepts requests without a valid grant → returns 402 with a signed quote
- Verifies proofs against Mirror Node before invoking your handler
- Rejects duplicate transaction IDs (idempotency)
- Publishes an HCS receipt after every successful call