Postman Collection
Test the x402 BSV payment gateway with this complete Postman collection. Covers both Profile A (demo mode) and Profile B (template settlement) flows.
Import into Postman
Download the collection
Click the download button above to save the JSON file.
Open Postman
Launch the Postman desktop app or open the web version.
Import the collection
Click Import (top-left), then drag and drop the JSON file. The collection appears in your sidebar.
Configure variables
Click the collection name, go to the Variables tab, and update gatewayUrl / delegatorUrl if your server runs on different ports.
What's Included
The collection is organized into folders covering both settlement profiles and all gateway endpoints.
Collection Variables
These variables are pre-configured with defaults. Update them to match your deployment.
| Variable | Default | Description |
|---|---|---|
| gatewayUrl | http://localhost:8402 | x402 gateway base URL |
| delegatorUrl | http://localhost:8403 | Fee delegator base URL |
| broadcastUrl | https://api.whatsonchain.com/v1/bsv/main/tx/raw | WhatsOnChain broadcast endpoint (Profile B) |
| arcUrl | https://arc.gorillapool.io/v1 | GorillaPool ARC base URL |
Profile A — Demo Mode
The simplest way to test the x402 protocol. The gateway handles proof-building server-side via POST /demo/build-proof.
Prerequisites
- Gateway running with
BROADCASTER=mock - No delegator service needed
Flow
GET /v1/expensive→ 402 + X402-Challenge headerPOST /demo/build-proof→ server builds proofGET /v1/expensive+ X402-Proof header → 200 OK- Replay same proof → 409 double_spend (replay protection)
Profile B — Template Settlement
Production flow where the gateway pre-signs a transaction template. The client orchestrates the settlement through the delegator.
Prerequisites
- Gateway running with
TEMPLATE_MODE=true - Delegator running on a separate port
- BSV broadcast endpoint reachable
6-Step Flow
GET /v1/expensive→ 402 + X402-Challenge (contains template)- Decode challenge → extract
template.rawtx_hex POST /delegate/x402with partial_tx → completed_tx + txidPOST broadcastUrlwith txhex → broadcast to BSV network- Build X402-Proof header from completed_tx + challenge binding
GET /v1/expensivewith X402-Proof → 200 OK
All Postman test scripts include automated assertions and console logging at every step.
Run with Newman (CLI)
You can also run the collection from the command line using Newman.
npm install -g newman
newman run x402-gateway-postman-collection.json