Skip to main content

Pincer SDK for Python

Simple, machine-native payments for the AI economy.

The Pincer SDK is a lightweight wrapper for the x402 protocol, specifically designed to handle Post-Pay Rebates and sponsored access. It enables API providers (Sellers) to monetize their services while allowing sponsors (Merchants) to subsidize the cost for high-intent agents.


🚀 Quick Start

Installation

pip install pincer-sdk

1. For Sellers: Protect your API

Sellers use Pincer to verify x402 payments and identify active sponsors using the built-in middleware.

from src.pincer_sdk import PincerClient
from src.pincer_sdk.middleware import PincerPaymentMiddleware
from x402.server import x402ResourceServer

client = PincerClient(
    base_url="https://your-pincer-url.com",
    api_key="your_api_key"
)

# Initialize standard x402 server with Pincer facilitator
server = x402ResourceServer(client.facilitator())

# Add Pincer middleware to your FastAPI app
app.add_middleware(PincerPaymentMiddleware, routes=routes, server=server)

# Your FastAPI route
@app.get("/premium-data")
async def get_data(request: Request):
    # Payment is already verified here!
    # Sponsors are automatically injected into the request state
    payment = getattr(request.state, "payment", None)
    sponsors = getattr(payment, "sponsors", []) if payment else []

    return {
        "data": "Premium content",
        "applied_sponsors": sponsors
    }

2. For Merchants: Report Conversions

Merchants notify Pincer when a transaction occurs to trigger user rebates.

from pincer_sdk import PincerClient

async with PincerClient(
    base_url="https://pincer.zeabur.app",  # URL is now required
    webhook_secret="your_secret"
) as pincer:
    await pincer.report_conversion(
        session_id="sess-123",
        user_address="0x...",
        purchase_amount=25.0,
        merchant_id="my-store"
    )

🏗 Why Pincer SDK?

The Pincer SDK enhances the base x402 experience by:

  • Injecting Sponsorship Data: Automatically capturing sponsor offers during the verification phase.
  • Simplifying Webhooks: Providing signed conversion reporting for merchants out of the box.
  • Managing Identity: Properly handling session IDs across the payment lifecycle.

📄 License

MIT

Release files for pincer-sdk 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pincer-sdk 0.1.2
File Size Uploaded
pincer_sdk-0.1.2.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pincer-sdk 0.1.2
File Interpreter ABI Platform
pincer_sdk-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 16.8 kB

Release files / pincer_sdk-0.1.2.tar.gz

Download URL pincer_sdk-0.1.2.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
67e407beb2c99ea3e8e0601b60f05f19d934d855c2e1e69f06b762e9dfec80fd
BLAKE2b-256 checksum
How to use checksums
7febeb0b0bccbd06cb56c6c39ff14c359a8cf309be41e2e04da11f317fdfcff6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Feb 10, 2026.

Transparency log

Release files / pincer_sdk-0.1.2-py3-none-any.whl

Download URL pincer_sdk-0.1.2-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7bfa9814325dc9269eb9ec427677b8570fe34ef751615c9f83e7219ebf25719
BLAKE2b-256 checksum
How to use checksums
acd6c1fe59cc738900ea1a6d15bc1d6d6bcbd617a4da71ead90d73a3fbc9b11c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Feb 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page