Skip to main content

Dual-protocol payments

Dual-protocol is the default Prudra configuration. Every 402 response includes both an x402 challenge (PAYMENT-REQUIRED header) and an MPP challenge (WWW-Authenticate header). The calling agent picks whichever protocol its wallet supports. Your server handles the result of either. You write one integration. It works with any agent.

How it works

Both challenges are built in a single buildDualChallenge() call before any response headers are written. There’s no race condition, no clock skew between the two challenges, and no risk of one challenge being flushed before the other is ready.

The 402 response

Every unauthenticated request to a Prudra-protected endpoint returns:
An x402-capable agent reads PAYMENT-REQUIRED, signs an ERC-3009 authorization, and resubmits with PAYMENT-SIGNATURE. An MPP-capable agent reads WWW-Authenticate, sends a Tempo transaction, and resubmits with Authorization: Payment. Your server accepts either — payMiddleware handles the verification path automatically based on which credential header is present.

Why dual-protocol

The agent payment ecosystem is split. Some agents use x402 (Base/USDC), others use MPP (Tempo/USDC.e). Without dual-protocol, you’d need to choose one and exclude agents using the other. With dual-protocol:
  • x402-only agents can pay
  • MPP-only agents can pay
  • Agents that support both can pick their preferred protocol
  • You maintain one endpoint, one integration

When to use only one protocol

There are cases where you might want only one protocol: For most integrations, keep the default dual-protocol. The overhead is negligible — both challenges are generated in one atomic call.