> ## 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

> Register Atum's MPP payment method with mppx and pay for MPP-gated resources directly from your agent's code.

Register `atum-escrow` as a payment method on your `mppx` client, and your agent can pay for any MPP-gated resource that accepts it — no example repo required.

```bash theme={null}
npm install @atumlabs/mppx-atum-escrow mppx zod ethers
```

```ts theme={null}
import { Mppx } from "mppx/client";
import { ethers } from "ethers";
import { registerClient } from "@atumlabs/mppx-atum-escrow/client";

// The source account is derived from your key. The server rejects a credential whose
// signature does not recover to it, so the two must match.
const account = new ethers.Wallet(PRIVATE_KEY).address;
const method = registerClient({ signer: { privateKey: PRIVATE_KEY }, account });

const mppx = Mppx.create({ methods: [method] });

// Call it like fetch — your agent's tool-call code doesn't need to branch
// on which payment method the resource ends up charging.
const res = await mppx.fetch("https://merchant.example/paid");
```

### What's happening

1. `registerClient` builds an `atum-escrow` client method for `mppx` — the same `Method.toClient()` idiom every MPP payment method (Stripe, Tempo) implements. The source account is derived from your key.
2. When the resource server returns a `402` with a challenge naming `atum-escrow`, `mppx` hands it to this method's `createCredential`.
3. `createCredential` reads the challenge's corridor terms (destination, deadlines, settlement vault/proxy/role addresses), builds the Atum `PaymentRequest`, and signs the source-side Permit2 authorization with your key.
4. `mppx` attaches the resulting credential to the retried request as `Authorization: Payment`, and returns the `200` with a `Payment-Receipt` header.

The wallet signs a **Permit2 authorization** — it does not broadcast a transaction. The deposit only executes on-chain once the merchant's server settles through the Payment Gateway.

<Warning>
  The source token must have an [`approve(Permit2)`](/get-started/concepts/permit2-and-approvals) allowance covering the spend, or the deposit reverts at settlement. The `ensureSourceApproval` helper in `@atumlabs/mppx-atum-escrow/client` can arrange it for you before paying.
</Warning>

<Note>
  **Past the gateway's \~30s window, expect pending — not a hung request.** The acceptance side submits and returns; when settlement is still in flight it answers pending and your client [re-attempts the same purchase](/payment-protocols/idempotency). Size the client's HTTP read timeout for that \~30s window (plus a small buffer), not for the full fulfillment deadline.
</Note>

## Next steps

| Topic                    | Link                                                                                       |
| ------------------------ | ------------------------------------------------------------------------------------------ |
| Merchant-side guide      | [Accept payments](/payment-protocols/mpp/accept-payments/overview)                         |
| Run the example first    | [Agentic sends](/payment-protocols/mpp/make-payments/agentic-payment-initiation)           |
| MPP client/SDK reference | [mpp.dev](https://mpp.dev/)                                                                |
| Paying via x402 instead  | [Develop with Atum SDK (x402)](/payment-protocols/x402/make-payments/develop-with-the-sdk) |
