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

# Quick Start

> Accept your first AI agent payment with Prism in minutes.

This guide takes you from zero to accepting AI agent payments. You'll set up a server endpoint that requires stablecoin payment via the x402 protocol — any AI agent with a compatible wallet can pay and access it.

## Prerequisites

* A [District Pass](/overview/district-pass) account
* A server-side application (Node.js, Python, or Java)
* A wallet address to receive settlement funds

You can test your integration on production with small amounts.

## Step 1: Get Your API Credentials

1. Log in to the [Prism Console](https://apps.fd.xyz/prism/) with your District Pass
2. Create a new Project or use the default Project
3. Navigate to **Project Identify Tokens** and generate a token
4. Copy your Project Identify Token — you'll need it for the SDK configuration

<Warning>
  Keep your Project Identify Token secret. Never expose it in client-side code or commit it to
  version control.
</Warning>

## Step 2: Install the SDK

<Tabs>
  <Tab title="TypeScript">
    `bash npm install @1stdigital/prism-express `
  </Tab>

  <Tab title="Python">
    <Info>
      **Coming soon.** Python SDKs (`prism-flask`, `prism-fastapi`, `prism-django`) are not yet published to PyPI. The install command below shows the planned package.
    </Info>

    ```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
    pip install finance-district
    ```
  </Tab>

  <Tab title="Java">
    <Info>
      **Coming soon.** The Java SDK (`prism-sdk`) is not yet published to Maven Central. The dependency below shows the planned coordinates.
    </Info>

    ```xml theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
    <dependency>
      <groupId>xyz.financedistrict</groupId>
      <artifactId>prism-sdk</artifactId>
      <version>LATEST</version>
    </dependency>
    ```
  </Tab>
</Tabs>

See [SDK Overview](/prism/sdk/overview) for all supported frameworks including NestJS, Next.js, FastAPI, Flask, Django, and more.

## Step 3: Add Payment Middleware

Protect an endpoint with x402 payment verification. When an agent hits this endpoint without paying, it gets a `402 Payment Required` response with payment instructions. After paying, the request goes through.

<Tabs>
  <Tab title="Express.js">
    ```typescript theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
    import express from "express";
    import { prismPaymentMiddleware } from "@1stdigital/prism-express";

    const app = express();

    app.use(
      prismPaymentMiddleware(
        {
          identifyToken: process.env.PRISM_IDENTIFY_TOKEN,
          baseUrl: "https://prism-gw.fd.xyz",
        },
        {
          "/api/premium": {
            price: "$0.01",
            description: "Premium API access",
          },
        }
      )
    );

    app.get("/api/premium", (req, res) => {
      res.json({
        message: "Premium content",
        payer: req.payer,  // wallet address that paid
      });
    });

    app.listen(3000, () => console.log("Server running on port 3000"));
    ```
  </Tab>

  <Tab title="FastAPI">
    <Info>
      **Coming soon.** The `prism-fastapi` package is not yet published to PyPI. The code below shows the planned API.
    </Info>

    ```python theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
    from fastapi import FastAPI, Depends
    from finance_district import require_payment, PaymentVerified

    app = FastAPI()

    @app.get("/api/premium")
    async def premium_content(
        payment: PaymentVerified = Depends(require_payment(0.01, "USD"))
    ):
        return {"content": "Premium data", "payer": payment.payer}
    ```
  </Tab>

  <Tab title="Flask">
    <Info>
      **Coming soon.** The `prism-flask` package is not yet published to PyPI. The code below shows the planned API.
    </Info>

    ```python theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
    from flask import Flask, jsonify
    from finance_district import require_payment

    app = Flask(__name__)

    @app.route("/api/premium")
    @require_payment(amount=0.01, currency="USD")
    def premium_content():
        return jsonify({"content": "Premium data"})
    ```
  </Tab>
</Tabs>

## Step 4: Test the Integration

Start your server and make a request to the protected endpoint:

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
curl http://localhost:3000/api/premium
```

You should get a `402 Payment Required` response:

```json theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
{
  "x402Version": 2,
  "error": "Payment required to access this resource",
  "resource": {
    "url": "https://api.example.com/api/premium",
    "description": "Premium API access",
    "mimeType": "application/json"
  },
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:84532",
      "amount": "10000",
      "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
      "payTo": "0xYourWallet...",
      "maxTimeoutSeconds": 300,
      "extra": {
        "name": "USD Coin",
        "version": "2"
      }
    }
  ],
  "extensions": null
}
```

This confirms the middleware is working. Any AI agent with a compatible wallet (including [Agent Wallet](/agent-wallet/overview)) can now pay and access the endpoint automatically.

<Tip>
  To test the full payment flow, use the [Agent Wallet
  CLI](/agent-wallet/ai-integration/cli) or connect an Agent Wallet via
  [MCP](/agent-wallet/ai-integration/mcp-server) and ask the agent to access
  your endpoint.
</Tip>

## Step 5: Go Live

When you're ready for production:

1. Switch to mainnet in your Prism Console Project settings
2. Generate a mainnet Project Identify Token
3. Update your wallet address to your production wallet
4. Monitor transactions in the [Prism Console](https://apps.fd.xyz/prism/)

<Note>
  You can test with small amounts on production chains. The API and SDK work identically
  regardless of transaction size.
</Note>

## What's Next?

<CardGroup cols={2}>
  <Card title="SDK Guides" icon="code" href="/prism/sdk/overview">
    Framework-specific integration for Express, NestJS, FastAPI, Django, and
    more
  </Card>

  <Card title="How Prism Works" icon="diagram-project" href="/prism/concepts/how-it-works">
    Two-layer architecture and transaction lifecycle
  </Card>

  <Card title="API Reference" icon="square-terminal" href="/prism/api-reference/introduction">
    Prism Gateway REST API documentation
  </Card>
</CardGroup>
