Skip to main content
Prism acts as the x402 facilitator — it adds payment enforcement to your HTTP endpoints without you implementing the protocol directly. You configure prices; Prism handles the 402 response, payment verification, and on-chain settlement.
This page covers x402 from the merchant/facilitator perspective. For the buyer/agent side, see Agent Wallet (Buyer Side).

How It Works

  1. A request arrives without a valid payment header
  2. Middleware returns 402 Payment Required with x402Version, accepts, and resource fields
  3. The agent’s wallet pays on-chain and retries with an X-PAYMENT header
  4. Prism’s Spectrum layer verifies the on-chain transfer
  5. If valid, the request proceeds and the transaction hash returns in X-PAYMENT-RESPONSE
Your application code only runs after payment is confirmed.

Integration

You don’t implement the x402 protocol directly — the Prism SDK middleware handles it. You configure what to charge, and the middleware handles the 402 response, payment verification, and settlement automatically. It’s available for TypeScript, Python, and Java frameworks:
See the Quick Start for a complete example, or the SDK Overview for framework-specific guides.

Payment Requirements (402 Response)

When the middleware returns 402, the response body contains: The resource object contains: Each entry in accepts contains:

Payment Verification

When the agent sends a request with the X-PAYMENT header:
  1. Prism parses the signed payment from the header
  2. Forwards it to the Spectrum settlement layer
  3. Spectrum executes the on-chain transfer and verifies: correct amount, correct token, correct recipient, valid signature
  4. If settlement succeeds, the request proceeds and the transaction hash is returned in the X-PAYMENT-RESPONSE header
  5. If settlement fails, the middleware returns 402 with an error
The merchant never needs to verify payments manually — the middleware handles everything between the 402 and the 200.

Pricing Models

Fixed Pricing

Set a static price per endpoint — every request costs the same:

Tiered Pricing

Different prices for different endpoints:

Dynamic Pricing

For endpoints where the price depends on the request, apply per-route middleware:
x402 is an open standard — learn more at x402.org. Prism implements the specification and handles the protocol complexity through the SDK, so you configure prices and the middleware does the rest.

SDK Overview

Framework guides for TypeScript, Python, and Java

x402 Implementation

Both sides of x402: the wallet signs, Prism settles
Last modified on July 7, 2026