[ Developers ]

Five lines. Then you ship.

Drop the middleware in. Point it at the coordinator. Your routes start accepting agent payments — atomic, escrowed, audit-logged. No SDK ceremony, no checkout forms, no per-provider account setup for the agent.

Python
pip install paygate402
Node
npm install paygate402

Quickstart

from paygate402 import require_payment
from fastapi import FastAPI

app = FastAPI()

@app.get("/api/v1/generate")
@require_payment(amount_usd=0.003, currency="USDC")
async def generate_image(prompt: str):
    # Your existing handler — middleware handles all the 402 dance
    image_url = await flux.generate(prompt)
    return {"url": image_url}

Try the API live

Hit the public providers endpoint right now — same coordinator that powers production. No auth needed for this read.

·https://api.paygate.agentglass.dev/api/v1/providers
GET request

Rails — Coinbase x402 vs Stripe MPP

You don't pick the rail at integration time. The provider advertises which rails they accept; the agent picks per call. Both flow through the same TEE escrow.

FeatureCoinbase x402Stripe MPP
Settlement assetUSDC on Base / SolanaUSD via Stripe
Settlement latency~400ms p50~1.9s p50
Agent identityOnchain pubkeyStripe ACP / SPT
Refund window30s TTL via TEE escrow30s TTL via PaymentIntent.cancel
Per-tx feeGas only (~10µ on Base)Stripe fees + 0.5% on top
Best fitCrypto-native agents, web3 opsMainstream B2B, fiat-required

Webhook events

Configure a webhook URL in your provider settings. Every event gets an HMAC-SHA256 signature in the X-PayGate-Webhook-Signature header.

payment.settled

Atomic payment completed. Agent received resource, provider received funds.

example payload
{
  "tx_id": "tx_01HXY…",
  "amount_micro_usd": 3000,
  "rail": "coinbase_x402"
}
payment.refunded

Escrow auto-refunded after provider failure or 30s timeout.

example payload
{
  "tx_id": "tx_01HXY…",
  "refund_reason": "provider_timeout_30s"
}
escrow.held

Funds moved to TEE escrow, awaiting provider response.

example payload
{
  "hold_id": "hold_01HX…",
  "auto_refund_at": "2026-05-15T01:42:43Z"
}
wallet.budget_exceeded

Agent wallet hit a configured cap. Payment never fired.

example payload
{
  "agent": "agent_x",
  "cap_usd_per_hour": 2,
  "spent": 2.05
}
dispute.opened

Agent flagged a delivery as bad. Provider has 24h to respond.

example payload
{
  "tx_id": "tx_01HXY…",
  "agent_reason": "response_was_empty_object"
}

Want help wiring this up?

I do hands-on integration calls — share a 30-min slot, your API base URL, and which rail you want first. I'll have it accepting agent payments before the call ends.

Get integration help

30 minutes. I'll wire PayGate402 into your stack live.