> ## 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. Load its publication and inspect the post's listed `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 paid request is charged. 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 { createWalletClient, http, publicActions } from "viem";
    import { base } from "viem/chains";
    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");
    const walletClient = createWalletClient({
      account,
      chain: base, // Use baseSepolia for testnet
      transport: http(),
    }).extend(publicActions);

    // 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(walletClient);
    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}`;

    // Check the discovery price before requesting payment.
    const publicationResponse = await fetch(
      `${baseUrl}/api/v1/publications/${firstPost.publicationSlug}?limit=100`,
    );
    const publication = await publicationResponse.json();
    const selectedPost = publication.posts.find(
      (post: { slug: string }) => post.slug === firstPost.slug,
    );

    console.log("Selected:", firstPost.title);
    console.log("Listed price (cents):", selectedPost?.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);
    ```
  </Tab>

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

    ```bash theme={null}
    npm install 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}`;

    // Check the discovery price before requesting payment.
    const publicationResponse = await fetch(
      `${baseUrl}/api/v1/publications/${firstPost.publicationSlug}?limit=100`,
    );
    const publication = await publicationResponse.json();
    const selectedPost = publication.posts.find(
      (post: { slug: string }) => post.slug === firstPost.slug,
    );

    console.log("Selected:", firstPost.title);
    console.log("Listed price (cents):", selectedPost?.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);
    ```
  </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...",
  "paymentInfo": {
    "amountUsd": "0.50",
    "protocol": "x402"
  }
}
```

The paid response is a robust synthesized summary with source context.
Requesting the same route again requires another payment.

## 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="Agent Cash">
    1. **Set up the wallet**

    ```text theme={null}
    Read https://agentcash.io/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>

  <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>
</Tabs>
