Deploy

Testnet demo merchant

The gateway image and two paid resources on Base Sepolia, run locally with Docker Compose.

Run the gateway image locally with Docker Compose and accept Base Sepolia payments for two resources. The demo has no hosted endpoint.

ResourcePriceBackend
report0.01 USDCapi.mjs, a static JSON report with no language model. Use it for automated buyer tests.
summarize_url0.02 USDCthe n8n workflow, an optional service

Payments settle through the public facilitator https://x402.org/facilitator, which takes no credential. Your MERCHANT_WALLET receives them as payTo.

Run

bash
git clone https://github.com/devlab-group/agent-commerce.git
cd agent-commerce/deploy/testnet-demo

export MERCHANT_WALLET=0xYourBaseSepoliaAddress
export ADMIN_TOKEN="$(openssl rand -hex 32)"
export GATEWAY_SHARED_SECRET="$(openssl rand -hex 32)"
docker compose up -d

curl -s localhost:8080/ready
curl -si -X POST localhost:8080/api/resources/report/invoke \
  -H 'content-type: application/json' -d '{}' | head -1

An unpaid call returns 402; its PAYMENT-REQUIRED header names eip155:84532, the Base Sepolia USDC contract 0x036CbD53842c5426634e7929541eC2318f3dCF7e and your wallet. GATEWAY_HOST_PORT changes the published port (default 8080), and GATEWAY_PUBLIC_BASE_URL defaults to http://localhost:8080.

To pay, a buyer needs Base Sepolia test USDC from faucet.circle.com and an x402 client with a signer for that wallet, such as the buyer core.

How the backends stay private

The demo API publishes no port. The gateway calls http://api:3001 over the default Compose network.

The optional n8n service fetches buyer-supplied URLs. It shares the separate n8n network with the gateway and has no direct Compose network connection to the demo API. Its UI is available on the host's loopback address at port 5678. n8n can still reach the gateway, host and internet; see the URL check's limits.

summarize_url with n8n

bash
docker compose --profile n8n up -d

Open http://localhost:5678, create the owner account, then follow the n8n setup: import deploy/n8n/summarize-url.json, create the Header Auth credential X-Gateway-Secret with the value of GATEWAY_SHARED_SECRET, attach a chat model credential and activate the workflow. The gateway reaches it at http://n8n:5678/webhook/summarize-url; set N8N_WEBHOOK_URL to use another n8n instance.

Payment flow

The demo uses paymentFlow: authorization: the gateway verifies the buyer's authorization, calls the backend, and settles after a 2xx response. Use upfront for workflows with side effects.

docker compose down stops the stack; add -v to delete the receipt store and the n8n data.

Based on: deploy/testnet-demo