x402 payment middleware for FastAPI — powered by the SwiftPay API
Project description
swiftpay-x402-fastapi-guard
x402 payment middleware for FastAPI — powered by the SwiftPay API.
Installation
pip install swiftpay-x402-fastapi-guard
Quick start
from fastapi import FastAPI
from swiftpay import AsyncSwiftPay
from swiftpay_x402_fastapi_guard import X402Guard
client = AsyncSwiftPay(secret_key="sk_live_...")
app = FastAPI()
app.add_middleware(
X402Guard,
client=client,
routes={"/v1/analyze": "https://api.example.com/v1/analyze"},
)
@app.get("/v1/analyze")
async def analyze():
return {"sentiment": "positive", "score": 0.87}
Routes not listed in routes pass through unaffected.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swiftpay_x402_fastapi_guard-0.1.1b0.tar.gz.
File metadata
- Download URL: swiftpay_x402_fastapi_guard-0.1.1b0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b69df70046c89f61b7db72a3022ea5823b9cffd20036209c72b8b5e1a63354f3
|
|
| MD5 |
ceb88e4d28d9b60efab472e4bb3391a3
|
|
| BLAKE2b-256 |
54e1226ad1e4f2e19d5b3c97abebeec8a3cd67dd5155bc826fb11f50610a944d
|
File details
Details for the file swiftpay_x402_fastapi_guard-0.1.1b0-py3-none-any.whl.
File metadata
- Download URL: swiftpay_x402_fastapi_guard-0.1.1b0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43feb564be382b39c71a0bf887dc83bca315468484075fa6b0658845eab68e52
|
|
| MD5 |
30e0d5f111de18be1df9a204f06873d1
|
|
| BLAKE2b-256 |
bcf11aedff135c6dff4abbaa5700018f649ff19850bd988448c967130f5cd4d8
|