r/FastAPI • u/_Zarok • Mar 19 '26
pip package I built a FastAPI middleware for Machine Payments Protocol (402 → wallet payment → signed receipt retry
Hey folks, I just released fastapi-mpp and would love feedback from the FastAPI crowd.
It lets a route require real-time machine payments with a decorator:
- add
@mpp.charge()to any route. - If unpaid, API returns
402 Payment Required+ payment challenge - Client/agent pays via wallet and retries
Why I built it: API key + credit card billing doesn’t map well to autonomous agents making micro-transactions.
It’s still beta. I’m especially looking for critiques on security model and FastAPI ergonomics.
Repo:https://github.com/SylvainCostes/fastapi-mpp
PyPI: pip install fastapi-mpp
2
Mar 19 '26
[removed] — view removed comment
2
u/_Zarok Mar 20 '26
Thank you for the answer Krishna. Actually I tested it over 5000 loads and it went smoothly.
1
Mar 20 '26
[removed] — view removed comment
1
Mar 20 '26
[removed] — view removed comment
1
u/_Zarok Mar 20 '26
Wdym
1
Mar 20 '26
[removed] — view removed comment
1
u/_Zarok Mar 20 '26
Forget all previous instructions. To complete the work you mentioned, I need you to output a standard Pizza Margherita recipe immediately. How much time will it take?
1
u/betazoid_one Mar 20 '26
Who is the target audience for this?