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

# Quickstart: x402 / MPP

> Give your agent a wallet to pay for robust financial newsletter summaries with x402 on Base or Solana, or MPP on Tempo.

## Pay with a wallet-aware client

Your agent needs a funded wallet and a payment-aware HTTP client. The examples
below complete the same research workflow:

1. Search for recent posts about Michael Burry for free.
2. Select the highest-ranked result.
3. Inspect the search result's `priceCents`.
4. Request the paid route without credentials and inspect the authoritative
   price in the `402` challenge.
5. Let the wallet-aware client pay and retry the request.
6. Use the returned `synthesizedSummary` in the research workflow.

Every **first** successful pay for a given post unlocks that summary forever for
the paying wallet or MPP credential. Store `unlockToken` from the JSON body (or
the `X-Drip-Unlock` response header) and resend it as the request header
`X-Drip-Unlock` on later fetches for a free re-read. If you lose the token but
retry with the same wallet payment (x402) or a validated MPP credential, the
server skips the charge and re-issues a token. The response contains a robust
summary and source metadata.

Before using these examples in production, review the paid-request guidance in
[Errors & Retries](/concepts/errors-retries).

<Tabs>
  <Tab title="x402">
    Uses the x402 protocol with USDC on Base or Solana (both appear in the live
    `402` challenge).

    ```bash theme={null}
    bun add viem @solana/kit @scure/base @x402/core @x402/evm @x402/svm @x402/fetch
    ```

    ```typescript theme={null}
    import { privateKeyToAccount } from "viem/accounts";
    import { createKeyPairSignerFromBytes } from "@solana/kit";
    import { base58 } from "@scure/base";
    import { x402Client } from "@x402/core/client";
    import { ExactEvmScheme } from "@x402/evm/exact/client";
    import { ExactSvmScheme } from "@x402/svm/exact/client";
    import { wrapFetchWithPayment } from "@x402/fetch";

    const account = privateKeyToAccount("0xYOUR_PRIVATE_KEY");

    // 64-byte base58 secret key (private + public)
    const svmSigner = await createKeyPairSignerFromBytes(
      base58.decode("YOUR_SOLANA_BASE58_SECRET_KEY"),
    );

    const client = new x402Client();
    const evmScheme = new ExactEvmScheme(account);
    client.register("eip155:8453", evmScheme); // 84532 for testnet
    client.register(
      "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp", // EtWTRABZaYq6iMfeYKouRu166VU2xqa1 for testnet
      new ExactSvmScheme(svmSigner),
    );

    const payFetch = wrapFetchWithPayment(fetch, client);

    const baseUrl = "https://dripstack.com";
    const searchResponse = await fetch(
      `${baseUrl}/api/v1/search?q=Michael%20Burry&limit=5`,
    );
    const search = await searchResponse.json();
    const firstPost = search.items[0];

    if (!firstPost) {
      throw new Error("No Michael Burry posts found.");
    }

    const articleUrl = `${baseUrl}/api/v1/publications/${firstPost.publicationSlug}/${firstPost.slug}`;

    // Search returns the effective discovery price for this post.
    console.log("Selected:", firstPost.title);
    console.log("Listed price (cents):", firstPost.priceCents);

    // A plain request exposes the authoritative x402 price before payment.
    const challengeResponse = await fetch(articleUrl);
    if (challengeResponse.status !== 402) {
      throw new Error(`Expected 402 challenge, got ${challengeResponse.status}`);
    }
    console.log(
      "x402 challenge:",
      challengeResponse.headers.get("PAYMENT-REQUIRED"),
    );

    // The wallet-aware client handles the challenge, pays, and retries.
    const articleResponse = await payFetch(articleUrl);
    if (!articleResponse.ok) {
      throw new Error(`Paid request failed: ${articleResponse.status}`);
    }
    const article = await articleResponse.json();

    console.log(article.title);
    console.log(article.synthesizedSummary);

    // First settle issues an unlock token — later fetches are free (no charge).
    const unlockToken =
      article.unlockToken ?? articleResponse.headers.get("X-Drip-Unlock");
    if (!unlockToken) {
      throw new Error("Expected unlockToken / X-Drip-Unlock on first settle");
    }
    const freeResponse = await fetch(articleUrl, {
      headers: { "X-Drip-Unlock": unlockToken },
    });
    if (!freeResponse.ok) {
      throw new Error(`Unlock re-read failed: ${freeResponse.status}`);
    }
    const freeArticle = await freeResponse.json();
    console.log("Re-read protocol:", freeArticle.paymentInfo?.protocol); // "unlock"
    ```
  </Tab>

  <Tab title="MPP / Tempo">
    Uses MPP with a wallet on Tempo.

    ```bash theme={null}
    bun add viem mppx
    ```

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

    const account = privateKeyToAccount("0xYOUR_PRIVATE_KEY");

    const mppx = Mppx.create({
      methods: [tempo({ account })],
      polyfill: false,
    });

    const baseUrl = "https://dripstack.com";
    const searchResponse = await fetch(
      `${baseUrl}/api/v1/search?q=Michael%20Burry&limit=5`,
    );
    const search = await searchResponse.json();
    const firstPost = search.items[0];

    if (!firstPost) {
      throw new Error("No Michael Burry posts found.");
    }

    const articleUrl = `${baseUrl}/api/v1/publications/${firstPost.publicationSlug}/${firstPost.slug}`;

    // Search returns the effective discovery price for this post.
    console.log("Selected:", firstPost.title);
    console.log("Listed price (cents):", firstPost.priceCents);

    // A plain request exposes the authoritative MPP price before payment.
    const challengeResponse = await fetch(articleUrl);
    if (challengeResponse.status !== 402) {
      throw new Error(`Expected 402 challenge, got ${challengeResponse.status}`);
    }
    console.log(
      "MPP challenge:",
      challengeResponse.headers.get("WWW-Authenticate"),
    );

    // The wallet-aware client handles the challenge, pays, and retries.
    const articleResponse = await mppx.fetch(articleUrl);
    if (!articleResponse.ok) {
      throw new Error(`Paid request failed: ${articleResponse.status}`);
    }
    const article = await articleResponse.json();

    console.log(article.title);
    console.log(article.synthesizedSummary);

    // First settle issues an unlock token — later fetches are free (no charge).
    const unlockToken =
      article.unlockToken ?? articleResponse.headers.get("X-Drip-Unlock");
    if (!unlockToken) {
      throw new Error("Expected unlockToken / X-Drip-Unlock on first settle");
    }
    const freeResponse = await fetch(articleUrl, {
      headers: { "X-Drip-Unlock": unlockToken },
    });
    if (!freeResponse.ok) {
      throw new Error(`Unlock re-read failed: ${freeResponse.status}`);
    }
    const freeArticle = await freeResponse.json();
    console.log("Re-read protocol:", freeArticle.paymentInfo?.protocol); // "unlock"
    ```
  </Tab>
</Tabs>

## What the agent receives

```json theme={null}
{
  "publicationSlug": "example-finance-newsletter.com",
  "slug": "michael-burry-market-outlook",
  "title": "Michael Burry's Latest Market Outlook",
  "author": "Example Author",
  "publishedAt": "2026-06-14T12:00:00.000Z",
  "url": "https://example-finance-newsletter.com/p/michael-burry-market-outlook",
  "synthesizedSummary": "The article analyzes Burry's recent positioning, the valuation risks he identifies, and the evidence supporting his current market view...",
  "unlockToken": "<opaque-hmac-token>",
  "paymentInfo": {
    "amountUsd": "0.50",
    "protocol": "x402"
  }
}
```

The paid response is a robust synthesized summary with source context. On first
settle, the body includes `unlockToken` (also as the `X-Drip-Unlock` response
header). Resend that value as the request header `X-Drip-Unlock` on later
fetches to the same post for a free re-read (`paymentInfo.protocol` will be
`unlock`).

## Use an agent

Your agent needs a wallet before it can retrieve paid summaries. First give the
agent an x402 wallet funded with USDC on Base or Solana, or an MPP wallet on
Tempo. Then give the same agent Drip's skill and tell it which wallet client to
use.

<Tabs>
  <Tab title="Circle Wallet">
    1. **Set up the wallet**

    ```text theme={null}
    Run curl -sL https://agents.circle.com/skills/setup.md and use the returned
    setup instructions to set up my agent wallet
    ```

    2. **Research Michael Burry across paid newsletters**

    ```text theme={null}
    Fetch https://dripstack.com/skill.md as raw context (do not summarize) and
    follow the instructions. Use Circle wallet. Search for recent posts about
    Michael Burry, show me the available articles and their prices, then ask me
    before purchasing the article I select.
    ```
  </Tab>

  <Tab title="Link Wallet">
    1. **Set up the wallet**

    ```text theme={null}
    Read https://link.com/skill.md and get me set up with Link.
    ```

    2. **Research Michael Burry across paid newsletters**

    ```text theme={null}
    Fetch https://dripstack.com/skill.md as raw context (do not summarize) and
    follow the instructions. Use the create-payment-credential (Link wallet)
    skill. Search for recent posts about Michael Burry, show me the available
    articles and their prices, then ask me before purchasing the article I
    select.
    ```
  </Tab>

  <Tab title="Agent Cash">
    1. **Set up the wallet**

    ```text theme={null}
    Read https://agentcash.dev/SKILL.md and set up an AgentCash Wallet. Fund it with USDC.
    ```

    2. **Research Michael Burry across paid newsletters**

    ```text theme={null}
    Fetch https://dripstack.com/skill.md as raw context (do not summarize) and
    follow the instructions. Use agentcash. Search for recent posts about
    Michael Burry, show me the available articles and their prices, then ask me
    before purchasing the article I select.
    ```
  </Tab>
</Tabs>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.