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

# Machine Payments Protocol (MPP)

> Enable AI agents to place orders and pay via HTTP 402 — no Zinc account required.

The [Machine Payments Protocol (MPP)](https://mpp.dev) is an open standard for machine-to-machine payments via HTTP 402, developed by Tempo and Stripe. Zinc supports MPP on the `/agent/orders` endpoint, allowing AI agents to place orders and pay in a single request flow — no Zinc account or API key required.

## Why MPP?

Traditional API integrations require account setup, API keys, and a pre-funded balance. MPP removes these steps by embedding payment directly into the HTTP request cycle:

* **No account needed** — Agents pay per-request using standard HTTP headers
* **Multiple payment methods** — Stripe cards/wallets, Tempo stablecoins, and more
* **Built for agents** — Designed for automated, machine-to-machine payment flows

## How It Works

MPP uses an HTTP 402 challenge-credential-receipt flow:

<Steps>
  <Step title="Request without payment">
    The agent sends a `POST /agent/orders` request without payment credentials.
  </Step>

  <Step title="Receive payment challenge">
    Zinc responds with HTTP `402 Payment Required` and `WWW-Authenticate` headers describing available payment methods and the amount due.
  </Step>

  <Step title="Complete payment">
    The MPP client completes payment through the chosen method (e.g., Stripe checkout, Tempo transfer) and receives a credential.
  </Step>

  <Step title="Resubmit with credential">
    The agent resubmits the original request with the payment credential in the `Authorization` header.
  </Step>

  <Step title="Order confirmed">
    Zinc validates the payment receipt and processes the order, returning a `201` response with order details and two important headers:

    * `X-Api-Key` — A temporary API key the agent can use to check order status via `GET /orders/{id}` without repeating the payment flow.
    * `Payment-Receipt` — The MPP payment receipt confirming the charge.
  </Step>
</Steps>

## Checking Order Status

The `201` response includes an `X-Api-Key` header containing a temporary API key. Use this key to poll the order status without going through the 402 payment flow again:

```bash theme={null}
curl https://api.zinc.com/orders/{order_id} \
  -H "Authorization: Bearer <X-Api-Key value>"
```

<Info>
  The `X-Api-Key` is scoped to the order it was issued for. Store it after placing the order so your agent can track fulfillment progress.
</Info>

## Quick Start

### Install an MPP Client

MPP client libraries handle the 402 flow automatically. Official SDKs are available in TypeScript, Python, and Rust.

<CodeGroup>
  ```bash npm theme={null}
  npm install mppx viem
  ```

  ```bash pip theme={null}
  pip install pympp
  ```
</CodeGroup>

### Place an Order

The easiest way to test is with the `mppx` CLI, which handles the 402 payment flow automatically:

```bash theme={null}
npx mppx https://api.zinc.com/agent/orders \
  --method POST \
  --body '{
    "products": [{"url": "https://www.amazon.com/dp/B0EXAMPLE"}],
    "shipping_address": {
      "name": "Jane Smith",
      "address_line1": "123 Main St",
      "city": "Seattle",
      "state": "WA",
      "postal_code": "98101",
      "country": "US",
      "phone": "2065551234"
    }
  }'
```

To integrate programmatically, use the client SDKs:

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { Mppx, tempo } from "mppx/client";
  import { privateKeyToAccount } from "viem/accounts";

  const mppx = Mppx.create({
    methods: [
      tempo({
        account: privateKeyToAccount("0x..."),
        maxDeposit: "1",
      }),
    ],
  });

  // The MPP client handles the 402 challenge flow automatically
  const response = await mppx.fetch(
    "https://api.zinc.com/agent/orders",
    {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({
        products: [
          { url: "https://www.amazon.com/dp/B0EXAMPLE" }
        ],
        shipping_address: {
          name: "Jane Smith",
          address_line1: "123 Main St",
          city: "Seattle",
          state: "WA",
          postal_code: "98101",
          country: "US",
          phone: "2065551234",
        },
      }),
    }
  );

  console.log(await response.json());
  ```
</CodeGroup>

## Supported Payment Methods

| Method     | Description                   |
| ---------- | ----------------------------- |
| **Stripe** | Cards and wallets via Stripe  |
| **Tempo**  | Stablecoin payments via Tempo |

<Info>
  The available payment methods are returned in the `WWW-Authenticate` headers of the 402 response. Your MPP client will automatically select a compatible method.
</Info>

## Next Steps

<CardGroup cols={3}>
  <Card title="MPP Playground" icon="play" href="https://agent.zinc.com">
    Try placing an MPP order in our interactive playground.
  </Card>

  <Card title="API Reference" icon="code" href="/v2/api-reference/agent/create-order">
    See the full API spec for the MPP order endpoint.
  </Card>

  <Card title="MPP Specification" icon="book" href="https://mpp.dev">
    Read the full MPP protocol specification.
  </Card>
</CardGroup>
