x402 Gateway
1. Run the demo
Open Quick starters, select Research Source Scout, and run its setup command in an empty folder. Then run:
npm run demoThe setup command verifies the download and runs npm ci. The demo funds Testnet accounts and starts the Express gateway. The consumer buys three resources. The contract rejects the fourth payment when the budget is exhausted.
2. Add your resource
Edit scenario/scenario.mjs to set the price, response, and business rules. src/fulfillment.mjs configures Express; src/consumer.mjs runs the consumer.
The API returns a 402 challenge. The consumer pays through the SDK, then retries with an ACKRATE bound-v2 payment proof. @ackrate/express-middleware verifies the ACKRATE proof on Stellar before calling your fulfillment callback and returning its JSON.
3. Run the gateway separately
Copy .env.example to .env and set ACKRATE_MERCHANT to a funded Testnet public address. Then run:
npm run fulfillmentThe gateway listens at http://127.0.0.1:4021 and serves GET /source/:sourceId. Keep .ackrate/, which stores keys and payment recovery evidence.