> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atum.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Develop with Atum SDK

> Gate your own route, tool, or API behind x402 payment with the @atumlabs/x402-atum-escrow server package.

Once you're past the demo, gate your own route, tool, or API directly with the `@atumlabs/x402-atum-escrow` server package — no example repo required.

```bash theme={null}
npm install @atumlabs/x402-atum-escrow @x402/core @x402/express
```

Register the scheme onto an `x402ResourceServer` with your corridor config, then build the route's `accepts[]` from the same config so there is a single source of truth for which source chains you offer:

```ts theme={null}
import { paymentMiddleware } from "@x402/express";
import { x402ResourceServer, HTTPFacilitatorClient } from "@x402/core/server";
import { registerAtumEscrowScheme, type AtumEscrowServerConfig } from "@atumlabs/x402-atum-escrow/server";

const config: AtumEscrowServerConfig = {
  // Where you receive: chain, token, and address.
  destination: { network: "eip155:42161", asset: "0x…USDC", address: "0x…merchant" },
  // Exact amount you receive, in atomic units of the destination token.
  fulfillmentAmount: "10000000",
  // Markup over fulfillmentAmount to derive each source cap, in basis points (300 = 3%).
  markupBps: 300,
  fulfillmentProxy: "0x…proxy",
  reserver: "0x…reserver",
  releaser: "0x…releaser",
  fulfillmentVerifierEndpoint: "https://…verifier",
  quoteDeadlineSeconds: 20,
  fulfillmentDeadlineSeconds: 300,
  // The source chains you accept, keyed by CAIP-2 network.
  sources: {
    "eip155:8453": { asset: "0x…baseUSDC", escrow: "0x…baseEscrow" },
    "eip155:42161": { asset: "0x…arbUSDC", escrow: "0x…arbEscrow" },
  },
};

const facilitatorClient = new HTTPFacilitatorClient({ url: process.env.FACILITATOR_URL! });
const server = registerAtumEscrowScheme(new x402ResourceServer(facilitatorClient), config);

// One accepts[] entry per source option, from the same config.
const accepts = Object.entries(config.sources).map(([network, source]) => ({
  scheme: "atum-escrow",
  network,
  payTo: source.escrow, // funds lock in the settlement vault, not with you
  price: "$0.10", // required by the route type, but ignored: the amount is fulfillmentAmount + markup
  maxTimeoutSeconds: 60,
}));

// Gate any route — an API endpoint, an MCP tool handler, whatever your
// agent-facing platform exposes.
app.use(paymentMiddleware({ "GET /paid": { accepts } }, server));
```

For a production integration, the contract addresses (`fulfillmentProxy`, `reserver`, `releaser`, `escrow` per source) and the `fulfillmentVerifierEndpoint` are Atum-network facts — read them from the payment gateway's `/v1/defaults` at startup rather than hardcoding them, so your business config (what/where you receive, markup, deadlines, which chains) stays the only thing you own locally.

<Info>
  The Atum-specific pieces above (`registerAtumEscrowScheme`, `AtumEscrowServerConfig`) match the `@atumlabs/x402-atum-escrow` package. `x402ResourceServer` and `HTTPFacilitatorClient` come from `@x402/core/server`. The route-mounting glue (`paymentMiddleware` from `@x402/express`) is the x402 Foundation's own Express integration — see the [x402 documentation](https://x402.org) for its exact API; mount the resource server however your framework prefers.
</Info>

<Note>
  Chain IDs, tokens, and addresses above are **illustrative placeholders**. Use [Supported networks](/get-started/reference/supported-networks) and [Supported assets](/get-started/reference/supported-assets) for the live catalog.
</Note>

<Warning>
  `registerAtumEscrowScheme` registers under the `eip155:*` wildcard by default; pass an explicit network list as the third argument to pin it. A malformed config throws at registration (fail-loud at startup).
</Warning>

<Tip>
  Declare the `payment-identifier` extension as required so the payer names each purchase. When settlement is still running, return pending with `PAYMENT-RESPONSE` set, and key delivery on the receipt's `payment_id`. See [Idempotency](/payment-protocols/idempotency).
</Tip>

## Next steps

| Topic                          | Link                                                                                   |
| ------------------------------ | -------------------------------------------------------------------------------------- |
| Run the demo first             | [Agentic receives](/payment-protocols/x402/accept-payments/agentic-payment-acceptance) |
| Idempotency                    | [Idempotency](/payment-protocols/idempotency)                                          |
| Payer-side guide               | [Make payments](/payment-protocols/x402/make-payments/overview)                        |
| Facilitator API reference      | [x402 Facilitator API](/api-reference/x402/introduction)                               |
| What the facilitator validates | [Verify payment](/api-reference/x402/verify)                                           |
| Settlement and receipts        | [Settle payment](/api-reference/x402/settle)                                           |
| Supported chains and tokens    | [Supported kinds](/api-reference/x402/supported)                                       |
