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

> Pay per stock-picks request with a wallet: x402 on Base or Solana, MPP on Tempo.

Use this path when the caller has no subscription — a wallet pays per request.
The flow is the same for both protocols:

1. Quote the day for free and read `amountUsd` and `dateUsed`.
2. Show the amount to your user and get approval.
3. Let the wallet-aware client pay and retry the request.
4. Read `picks[]` from the paid response.

Bundles are charged per request; a purchase does not create a lifetime post
unlock. If the caller has a paid plan, the same route serves the request free —
see [Quickstart: API Keys](/v2/quickstart-api-keys).

<Tabs>
  <Tab title="x402">
    x402 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 limit = 200;

    // 1. Free preflight — never pay an unquoted amount.
    const quoteResponse = await fetch(
      `${baseUrl}/api/v2/stock-picks/quote?date=2026-05-30&limit=${limit}`,
    );
    const quote = await quoteResponse.json();
    if (!quote.count) {
      throw new Error("No picks for that day; do not pay.");
    }
    console.log(`Approve $${quote.amountUsd} for ${quote.count} picks?`);
    // ...confirm with your user...

    // 2. Use the quoted dateUsed and the same limit on the paid request.
    const picksUrl = `${baseUrl}/api/v2/stock-picks?date=${quote.dateUsed}&limit=${limit}`;

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

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

    console.log(`Plan ${meta.plan}, paid for ${pagination.count} picks on ${meta.appliedRange.to}`);
    for (const pick of picks) {
      console.log(pick.ticker, pick.action, `conviction ${pick.conviction}`, pick.author);
      console.log(`  "${pick.evidenceQuote}"`);
    }
    ```
  </Tab>

  <Tab title="MPP / Tempo">
    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 limit = 200;

    // 1. Free preflight — never pay an unquoted amount.
    const quoteResponse = await fetch(
      `${baseUrl}/api/v2/stock-picks/quote?date=2026-05-30&limit=${limit}`,
    );
    const quote = await quoteResponse.json();
    if (!quote.count) {
      throw new Error("No picks for that day; do not pay.");
    }
    console.log(`Approve $${quote.amountUsd} for ${quote.count} picks?`);
    // ...confirm with your user...

    // 2. Use the quoted dateUsed and the same limit on the paid request.
    const picksUrl = `${baseUrl}/api/v2/stock-picks?date=${quote.dateUsed}&limit=${limit}`;

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

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

    console.log(`Plan ${meta.plan}, paid for ${pagination.count} picks on ${meta.appliedRange.to}`);
    for (const pick of picks) {
      console.log(pick.ticker, pick.action, `conviction ${pick.conviction}`, pick.author);
      console.log(`  "${pick.evidenceQuote}"`);
    }
    ```
  </Tab>
</Tabs>

## What the agent receives

```json theme={null}
{
  "meta": {
    "plan": "PAID",
    "allowedRange": null,
    "appliedRange": { "from": "2026-05-30", "to": "2026-05-30" },
    "requestAllowance": null,
    "asOf": "2026-05-31T00:05:12.482Z"
  },
  "pagination": { "count": 2, "nextCursor": null },
  "picks": [
    {
      "date": "2026-05-30",
      "ticker": "NVDA",
      "tickerExchange": "NASDAQ",
      "instrumentType": "EQUITY",
      "assetId": "asset_9f2c1d",
      "assetResolutionStatus": "RESOLVED",
      "asset": {
        "id": "asset_9f2c1d",
        "name": "NVIDIA Corporation",
        "kind": "EQUITY",
        "symbol": "NVDA",
        "exchangeMic": "XNAS",
        "currency": "USD"
      },
      "action": "EXIT",
      "author": "Example Analyst",
      "publicationSlug": "example-finance-newsletter.com",
      "publicationTitle": "Example Finance Newsletter",
      "articleUrl": "https://dripstack.com/api/v1/publications/example-finance-newsletter.com/nvda-position-review",
      "conviction": 3,
      "convictionLabel": "medium",
      "evidenceQuote": "Closing the NVDA short; the AI capex trade has priced in a year of growth.",
      "thesis": "The author exits an existing short after consensus revenue estimates moved above the prior peak, arguing the entry multiple now assumes flawless execution.",
      "sentiment": "BEARISH",
      "rationaleSnippet": "Exit short; consensus estimates moved above the prior peak.",
      "publishedAt": "2026-05-30T11:24:07.000Z"
    },
    {
      "date": "2026-05-30",
      "ticker": "BTC-USD",
      "tickerExchange": null,
      "instrumentType": "CRYPTO",
      "assetId": "asset_7b41ee",
      "assetResolutionStatus": "RESOLVED",
      "asset": {
        "id": "asset_7b41ee",
        "name": "Bitcoin",
        "kind": "CRYPTO",
        "symbol": "BTC-USD",
        "exchangeMic": null,
        "currency": "USD"
      },
      "action": "OPINION",
      "author": "Third Writer",
      "publicationSlug": null,
      "publicationTitle": null,
      "articleUrl": "https://third-writer.substack.com/p/btc-position-review",
      "conviction": 4,
      "convictionLabel": "high",
      "evidenceQuote": "Still structurally bullish bitcoin, but I would not add above this level until the ETF flows turn.",
      "thesis": "The author expresses a directional view without framing it as a trade, so no entry or exit is extracted.",
      "sentiment": "BULLISH",
      "rationaleSnippet": "Structural bullishness; waiting on ETF flows before adding.",
      "publishedAt": "2026-05-30T13:41:20.000Z"
    }
  ],
  "paymentInfo": {
    "amountUsd": "1.85",
    "protocol": "x402"
  }
}
```

`meta.plan` is `PAID` for every wallet-paid request, `allowedRange` and
`requestAllowance` are `null`, and `appliedRange` collapses to the single quoted
day. Each pick carries the call (`action`, `sentiment`, `conviction`), who made
it (`author`, `publicationTitle`), the evidence, and the source `articleUrl`.

The bundle is charged per request and covers the whole day — do not buy the same
day twice. On the paid path `prices` are omitted and `pagination.nextCursor` is
`null`; a subscription plan gets historical `prices` (`entry`, `current`,
direction-adjusted `returnPct`, `currency`) instead. See
[Stock Picks](/v2/stock-picks#pick-fields).

## Related reads

* [Quickstart: API Keys](/v2/quickstart-api-keys) — subscription instead of
  per-request payment, with range paging.
* [Stock Picks](/v2/stock-picks) — every field, filter, and error.
* [Company Lookup](/v2/companies) — resolve `assetId` back to a company card.

## Use an agent

Your agent needs a wallet before it can pay for picks. Give the agent a wallet
funded with USDC on Base or Solana (x402) or on Tempo (MPP), then 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. **Track NVDA calls for the last week**

    ```text theme={null}
    Fetch https://dripstack.com/skill.md as raw context (do not summarize) and
    follow the instructions. Use Circle wallet. Quote the stock picks feed for
    2026-05-30, show me how many picks there are and what they cost, then ask me
    before paying. After payment, summarize the LONG and SHORT calls by ticker.
    ```
  </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. **Track NVDA calls for the last week**

    ```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. Quote the stock picks feed for 2026-05-30, show me the pick count and
    amountUsd, then ask me before paying. After payment, group the picks by
    direction and list the evidence quotes.
    ```
  </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. **Track NVDA calls for the last week**

    ```text theme={null}
    Fetch https://dripstack.com/skill.md as raw context (do not summarize) and
    follow the instructions. Use agentcash. Quote the stock picks feed for
    2026-05-30, show me the amountUsd, then ask me before paying. After
    payment, show the most-repeated tickers and who published each call.
    ```
  </Tab>
</Tabs>


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