Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.prudra.dev/llms.txt

Use this file to discover all available pages before exploring further.

Payments overview

Prudra’s payment middleware adds HTTP 402 payment gating to any endpoint. When a calling agent hits a protected route without a valid payment, it receives a 402 response containing challenges for both the x402 and MPP protocols. The agent pays using whichever protocol its wallet supports, then resubmits. Your handler only runs after payment is verified. You write one integration. Prudra handles both protocols.

How it works

Each successful payment automatically creates a vault — a persistent workspace where your handler stores its output. The agent receives the vault ID in the response and can retrieve the results at any time.

The two protocols

x402

The open standard backed by Coinbase. Settles on Base in USDC. The agent signs an ERC-3009 authorization off-chain — no gas cost to the agent for signing. Best for agents using Base-compatible wallets.

MPP

The IETF Internet Draft backed by Stripe and Tempo. Settles on Tempo in USDC.e. Required for session payments. Best for multi-step agent workflows.
By default, payMiddleware generates both challenge types in every 402 response. This is the recommended approach — your API works with any agent regardless of which protocol it supports.

Dual-protocol payments

Both headers in every 402. The agent picks the protocol that matches its wallet. You write one integration.

Session payments

Session payments let one payment cover an entire multi-step workflow. The agent pays once, and all subsequent requests in the session share the same vault.

Session payments

MPP-only. Pro plan required. One payment covers a workflow — all steps write to the same vault.

When to use which approach

If your agents use…Use…
Base + USDCx402 or dual-protocol
Tempo + USDC.eMPP or dual-protocol
Multiple protocols (mixed agent pool)Dual-protocol (default)
Multi-step workflowsSession payments (MPP)
Any single request, cheapest setupDual-protocol with default options
For new integrations, use dual-protocol. You get maximum agent compatibility with no additional code.

Security

Prudra implements four payment security measures automatically:
  • Replay protection — UNIQUE constraint on txHash at the Postgres level prevents double-spending
  • Challenge harvesting protection — Rate limiting (20 challenges/IP/60s) and no challenge on error responses
  • Atomic challenge generation — Both challenges are built in one call, eliminating clock skew
  • Stateless MPP verification — HMAC-SHA256 challenge IDs require no database lookup to verify
See Payment security for details.