SDK Reference
PincerPaymentMiddleware
The recommended way to protect your API. It handles the x402 challenge-response loop and automatically injects Pincer-specific data (like sponsors).
Usage (FastAPI)
from pincer_sdk.middleware import PincerPaymentMiddleware
from x402.server import x402ResourceServer
# ... initialize client and facilitator
server = x402ResourceServer(facilitator)
# Add middleware to your app
app.add_middleware(PincerPaymentMiddleware, routes=routes, server=server)
PincerFacilitatorClient
A specialized FacilitatorClient that preserves Pincer-specific data (like sponsors) during the verification process.
Usage
Accessing Sponsors
After verification, you can access sponsors in your route handlers: