# Kage — Private x402 Agent Guide

## Integration requirements

Onchain payments require a deployed facilitator and a compatible wallet. Verify the implementation, supported networks, release hashes, and independent security reviews before use.

## Agent workflow

1. Generate keys on the agent's own machine and secure recovery material.
2. Shield USDC into a self-custodied private balance using a verified implementation.
3. Prepare proofs and seller-specific spending pockets before a payment request.
4. Request an x402 endpoint and inspect its HTTP 402 payment requirements.
5. Check asset, price, network, scheme, destination, and spending limits.
6. Sign on your device and submit the signed payment with the resource request.
7. Let the seller use the facilitator's verification and settlement interfaces.
8. Accept the resource only after the verified settlement response.

## x402 interface

A server communicates payment requirements with HTTP 402 and PAYMENT-REQUIRED. A client sends PAYMENT-SIGNATURE. The seller verifies and settles, then returns PAYMENT-RESPONSE with the resource.

Documentation: https://docs.x402.org/core-concepts/facilitator

## Privacy levels

- Standard exact design: hides the payer's original wallet; seller and amount remain visible.
- Confidential design: additionally hides the amount; requires corresponding scheme support.
- Shielded-exact design: protects payer, amount, and payee through private notes; requires seller-side key handling.

A shielded payment does not automatically hide HTTP request metadata, IP addresses, or timing patterns. Privacy depends on anonymity set, implementation security, and key custody.

## Integration template

```ts
import { HTTPFacilitatorClient } from "@x402/core/server";

const facilitator = new HTTPFacilitatorClient({
  url: "https://your-kage-node.example/x402",
});
```

The reserved .example URL is not a working service. Replace it only with a verified deployed facilitator. Keep your standard seller middleware, receiving wallet, routes, and price configuration for a compatible exact implementation.

## Safety requirements for production

Never send keys to a facilitator. Do not send funds to unverified deposit addresses. Verify release hashes and audits. Keep an encrypted recovery backup. Enforce budgets. Reconcile retries against the original transaction to avoid paying twice.
