Integration manifest
Five stations to
your first 402.
The decision, dry run, and testnet challenge run today. Start with no wallet, watch real decisions, then switch the same rules to testnet x402. Production mainnet settlement is preview.
Provision
Create a workspace, then copy both keys from Setup → Project & keys.
The public key (pk_) authorizes the decision call and can
live on your edge. The secret key (sk_) authorizes
settlement reporting and configuration; keep it in server-side environment variables.
VOLANCE_PUBLIC_KEY=pk_live_...
VOLANCE_SECRET_KEY=sk_live_...
VOLANCE_BASE=https://app.volance.com
The portal does not show the secret again after its reveal window, and it never keeps
your facilitator key. sk_ belongs on the gateway, not in the browser or the
collector.
Pick a mode
Monetization is off by default. Dry run is the safe second step.
| Mode | A charge returns | Needs |
|---|---|---|
| Off | Nothing; every request is allow with reason monetization_disabled. |
— |
| Dry run (IOU) | A signed record of a modeled charge. No money moves, and no payer commitment is established. | No wallet |
| Live (x402) | A ready x402 v2 challenge; the agent pays through your facilitator. | A wallet + facilitator |
Set the toll
Rules override the default policy by path and caller. Highest priority wins.
A rule is evaluated against the path, classification label, trust level, and agent id.
Unset match fields apply to every caller. A scope is *, an exact path, or a
prefix glob such as /articles/*.
{
"scope": "/articles/*",
"matchLabel": "agent",
"matchTrust": "verified_agent",
"decision": "charge",
"priceUsd": 0.002,
"priority": 10
}
A charge without priceUsd uses the workspace default price
(initially $0.002).
human allow (free)
verified agent charge (default price)
unsigned agent allow (flagged)
unlisted agent allow (flagged)
spoofed disclosure block
bot / abuse block
Unsigned automation is never charged by default. Charging unverified traffic invites wash and fraud; it is flagged unless you opt in.
Check before you save. The policy simulator evaluates a hypothetical path, class, and trust level against the saved rules. It persists nothing and bills nothing.
Ask for a decision
One call per request, from your edge, with what you can see.
curl -s https://app.volance.com/api/trace/agent/decide \
-H "Authorization: Bearer $VOLANCE_PUBLIC_KEY" \
-H "Content-Type: application/json" \
-d '{
"path": "/articles/premium",
"method": "GET",
"requestSignals": {
"visitorIp": "203.0.113.7",
"visitorUserAgent": "ExampleAgent/1.0",
"acceptLanguage": "en-US",
"secChUa": ["Chromium", "Not A;Brand"],
"secFetchSite": "none",
"secFetchMode": "navigate",
"cookiePresent": false
},
"disclosureHeaders": {
"signature-input": "sig1=(...);keyid=\"agent.example\"",
"signature": "sig1=:base64-signature:",
"signature-agent": "\"agent.example\"",
"authority": "example.com"
}
}'
{
"decision": "charge",
"reason": "verified_agent",
"flagged": false,
"classification": { "label": "agent", "confidence": 0.93 },
"trust": "verified_agent",
"agentId": "agent.example",
"matchedRule": "rule_01",
"priceUsd": 0.002,
"settlementMode": "x402",
"paymentRequired": {
"x402Version": 2,
"accepts": [{
"scheme": "exact",
"network": "eip155:84532",
"asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
"payTo": "0xYourWallet",
"maxAmountRequired": "2000",
"resource": "/articles/premium",
"maxTimeoutSeconds": 60
}]
},
"paymentRequiredHeader": "eyJ4NDAyVmVyc2lvbiI6Miw...",
"monetizeQuota": { "state": "ok", "paused": false }
}
paymentRequired is null outside a charge. In dry run the charge carries
iou instead. paymentRequiredHeader is the base64 form.
| Field | Use |
|---|---|
| path | Required. The resource path being priced. |
| method | The HTTP method. Defaults safely when omitted. |
| requestSignals | What your edge can see: IP, user agent, language, client hints, fetch metadata, cookie presence. |
| disclosureHeaders |
The Web Bot Auth headers (signature-input, signature,
signature-agent, authority).
|
| classification |
Optional { label, confidence } if you already scored the request;
otherwise Volance classifies the supplied signals.
|
| agentId | Optional override; otherwise it comes from the disclosure key id. |
Enforce at the edge
Map the three decisions to three responses. The resource stays on your server.
const VOLANCE = "https://app.volance.com";
export default {
async fetch(request, env) {
const url = new URL(request.url);
const decision = await fetch(VOLANCE + "/api/trace/agent/decide", {
method: "POST",
headers: {
Authorization: "Bearer " + env.VOLANCE_PUBLIC_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
path: url.pathname,
method: request.method,
requestSignals: {
visitorIp: request.headers.get("cf-connecting-ip"),
visitorUserAgent: request.headers.get("user-agent"),
cookiePresent: Boolean(request.headers.get("cookie")),
},
disclosureHeaders: {
"signature-input": request.headers.get("signature-input"),
signature: request.headers.get("signature"),
"signature-agent": request.headers.get("signature-agent"),
authority: url.host,
},
}),
}).then((r) => r.json());
if (decision.decision === "allow") return fetch(request);
if (decision.decision === "block") return new Response("Forbidden", { status: 403 });
if (!request.headers.get("PAYMENT-SIGNATURE")) {
return new Response("Payment Required", {
status: 402,
headers: { "PAYMENT-REQUIRED": decision.paymentRequiredHeader },
});
}
// 1. verify with YOUR facilitator
// 2. serve the resource
// 3. settle with YOUR facilitator
// 4. report the settlement to Volance (station 06)
},
};
The portal's Gateway setup has the full reference Worker, including verify, settle, and report. This excerpt stops at the 402 on purpose.
Set a timeout and a fallback. The decision call is synchronous. If it times out or errors, your gateway must still answer: serve the resource, serve a preview, or return an error, according to your own policy. An outage at Volance should not take your site down.
409 with a setup message. Use dry run until the wallet is set.
Settle and report
Your facilitator moves the money. Volance only meters the result.
- The agent retries with
PAYMENT-SIGNATURE. - Your edge verifies it with your facilitator's
/verify. - Your edge serves the resource.
- Your edge settles with your facilitator's
/settle; USDC lands inpayTo. - Your edge reports the settled payment to Volance.
curl -s https://app.volance.com/api/trace/agent/settlement \
-H "Authorization: Bearer $VOLANCE_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"resource": "/articles/premium",
"amountUsd": 0.002,
"network": "eip155:84532",
"txRef": "0x9f2c...e41"
}'
A first report returns { "recorded": true, "id": "ast_..." }. Repeating
the same txRef returns duplicate: true and does not meter
twice.
No custody, no cut. Volance never settles, never holds funds, and takes no percentage. Settlement reporting exists to meter the included volume and show the payment in the portal.
Dry run is different. In IOU mode a charge returns a signed record and no
402. The record carries the same price, asset, network, and payTo a live
charge would; it is settled only with explicit payer authorization.
Test plan
Six checks, in order. Stop at the first one that does not behave.
-
Off. Send a request with monetization off. The decision is
allow, reasonmonetization_disabled, and nothing is charged. -
Simulator. Verified agent on
/articles/*returnschargeat your price; spoofed disclosure returnsblock. -
Dry run. A real request produces a charge and a signed IOU. Verify it
offline against
GET /api/trace/agent/iou/jwks. No money moves. -
Testnet x402. Set Base Sepolia and a test wallet. Send a request with
no payment header; expect
402and aPAYMENT-REQUIREDchallenge foreip155:84532. -
Pay and settle. Pay with test USDC through your facilitator, retry
with
PAYMENT-SIGNATURE, and confirm the resource is served. Report the settlement; confirm the portal shows it once. - Ledger and CSV. Find the decision in Monetize → Decisions, filter by outcome, and export the filtered rows. Confirm the IOU/charge, trust, and price are right.
Reference
The fields, limits, and failure paths you will actually meet.
| Endpoint | Auth | Purpose |
|---|---|---|
| POST /api/trace/agent/decide | pk_ |
Classify, resolve trust, evaluate rules, return the decision and challenge. |
| POST /api/trace/agent/settlement | sk_ |
Report a settled payment; meters included volume and dedupes by txRef. |
| GET | POST /api/trace/agent/config | sk_ |
Read or change mode, wallet, network, default price, facilitator. |
| POST /api/trace/agent/iou | pk_ |
Verify a signed IOU and read its ledger status. |
| GET /api/trace/agent/iou/jwks | None | Public Ed25519 key for offline IOU verification. |
| Field | Meaning |
|---|---|
| decision | allow → 200, charge → 402, block → 403. |
| reason |
Why: human, bot, verified_agent,
unlisted_agent, spoofed_disclosure, rule,
monetization_disabled, or monetize_volume_paused.
|
| classification.label | human, agent, or bot — an estimate, not authorization. |
| trust |
verified_agent, unresolved_signer,
spoofed_disclosure, or none.
|
| priceUsd | Present on a charge; otherwise null. |
| matchedRule | The rule id that produced the decision, or null when the default applied. |
| paymentRequired / iou | A challenge in x402 mode, a signed record in dry run, null otherwise. |
| paymentRequiredHeader | The base64 challenge to send as PAYMENT-REQUIRED. |
| monetizeQuota | Volume and decision usage for the month, and whether charging is paused. |
| Situation | What happens | Your edge should |
|---|---|---|
| Decision call times out or 5xx | No decision reached. | Apply your fallback; log it. Do not fail open silently. |
| x402 charge, no wallet | 409 with a setup message. |
Set a wallet or stay in dry run. |
| Volume or decision cap hit | allow, flagged, reason monetize_volume_paused. |
Serve; block decisions still block. Upgrade or wait for the reset. |
| Spoofed disclosure | block, reason spoofed_disclosure. |
403 and do not serve. |
No PAYMENT-SIGNATURE |
The challenge is still valid. | Return the same 402 and PAYMENT-REQUIRED. |
Repeated settlement txRef |
duplicate: true, not metered again. |
Treat it as success; do not retry with a new ref. |
- Default price
- $0.002 until a rule or config changes it.
- USDC decimals
- 6 so $0.002 is
2000atomic units. - Testnet
- Base Sepolia,
eip155:84532. - Mainnet
- Base,
eip155:8453. - IOU lifetime
- 30 days from issue.
- Decision events
- 30-day TTL with a salted IP hash, never the raw IP.
- Settlement records
- 400-day TTL.
- Plan caps
- Free 500k decisions / $50k volume; Pro 5M / $1M; Business 50M / $10M. +25% grace, then charge pauses to allow.