What the wrapper handles
The wrapper handles the payment mechanics around a normal HTTP request.Read payment requirements
The wrapper receives the seller’s payment requirements from the protected route.
What your policy should handle
Your policy handles judgment. It decides whether the seller, route, amount, network, asset, and task context are allowed before the wrapper signs.| Policy area | Decision |
|---|---|
| Spend limits | Maximum price per request and maximum spend per task. |
| Seller access | Allowed sellers, domains, networks, and assets. |
| Approval | Thresholds that require a person or higher-level policy. |
| Blocking | Categories, routes, or sellers the agent should never pay. |
| Audit | Reason codes, logging, and alerting for every paid request. |
TypeScript fetch wrapper
Signing rules
Before signing, validate the payment against your policy. The amount should fit the budget, the seller address should match the expected service, the route should match the task, and the network and asset should be approved. If the payment crosses an approval threshold, collect approval before signing. If the task budget has no room left, return a controlled error so the agent can pick another service, ask for approval, or stop. When a seller requirement does not clearly match policy, pause signing and ask for help.Logging rules
Automatic payment should still be explainable. Each paid request should connect task ID, request ID, guarantee ID, seller domain, sellerpayTo address, route, amount, network, asset, policy version, reason for payment, and final result or error.
These logs answer “why did the agent pay?” after the task is done.