Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Building a One-Cent API with x402 on Base

Описание и применение

Создана API, продающая один полезный ответ за 0,01 USD без аккаунтов и ключей, используя x402 на Base. Реализован платежный шлюз, разделение бесплатного и платного контента, мобильный поток с deep‑link, псевдоанонимный сбор метрик и открытая документация.

Задача

How to sell a single useful API response for $0.01 without requiring accounts, keys, or checkout pages while keeping the experience frictionless and privacy‑preserving.

Результат

The one‑cent API loop works end‑to‑end: discovery, free response, payment authorization, settlement, paid response, and privacy‑preserving analytics. Mobile support and clear error messages improved usability.

Рабочий процесс

  • 1. Client requests paid route via fetch wrapped with @x402/fetch and @x402/evm. 2. Server responds with 402 and payment requirements. 3. Client signs payment authorization in MetaMask. 4. Request retried with payment payload. 5. Facilitator verifies and settles payment. 6. Server returns paid response with source links. 7. Client displays free or paid content based on response.
  • 8. Mobile visitors without injected wallet trigger MetaMask deep link. 9. Browser generates rotating HMAC pseudonym in X-Launch-Visitor header. 10. Server aggregates unique free/paid users and repeat paid users over 7 days.
  • 11. Public stats endpoint exposes aggregate counts without sensitive data.

Доказательства

The live project has three free indexes: GLP-1 questions, supplement interactions, and peptide/longevity questions. Each has a paid counterpart that returns a longer research brief with named source links.

Источник

The first stats endpoint counted requests per route and paid unlocks. It intentionally stored no health queries, wallet addresses, IP addresses, or user agents.

Источник

The mobile flow now uses a MetaMask app deep link when a provider is missing.

Источник

  • Дата записи: 2026-09-22T03:00:38.809Z