Sandbox mode — no real money moves.

Seller setup

Complete these 4 steps to gate any Hono or Express route with HTTP 402 and receive PayPal Payouts.

1. Payout account

active

Connected PayPal destination for POST /v1/payments/payouts:

Email: builder@sandbox.paypal.example.com
PayPal Payer ID: WDJJHEBZ4X2LY
Seller ID: slr_01J9Y8…0001
2

2. Create a seller key

Your seller middleware uses HAGGLES_SELLER_KEY (hgs_test_...) to call POST /v1/settle and POST /v1/release.

3

3. Install @haggles/server middleware

Pre-filled with your Seller ID (slr_01J9Y8SANDBOXDEMO00000001):

import { Hono } from "hono";
import { paywall } from "@haggles/server/hono";
const app = new Hono();
app.get(
"/v1/datasets/lithium/spot",
paywall({
price: "0.03",
sellerId: "slr_01J9Y8SANDBOXDEMO00000001",
sellerKey: process.env.HAGGLES_SELLER_KEY!,
description: "Lithium spot price index (USD/mt)",
}),
(c) => c.json({ commodity: "lithium_carbonate", spot_usd_mt: 13450 }),
);
4

4. Make a first paid call

In sandbox mode, you can mint a pre-funded $0.50 buyer agent key to test your endpoint end-to-end:

HAGGLES_KEY=hgk_test_... bun -e '
import { createPaidFetch } from "@haggles/client";
const paidFetch = createPaidFetch({ apiKey: process.env.HAGGLES_KEY! });
const res = await paidFetch("http://localhost:4010/v1/datasets/lithium/spot");
console.log(res.status, await res.json());
'