Documentation

If you can send an HTTP request, you can use PayPerScrape.

Quick example

typescript
import { createSigner, wrapFetchWithPayment } from "@coinbase/x402";

const signer = await createSigner("base", privateKey);
const fetchWithPayment = wrapFetchWithPayment(fetch, signer);

const response = await fetchWithPayment(
  "https://payperscrape.com/api/scrape",
  {
    method: "POST",
    body: JSON.stringify({
      url: "https://example.com"
    })
  }
);

const body = await response.json();
// {
//   "status": "success",
//   "html": "<!DOCTYPE html>...",
//   "metadata": {
//     "domain": "example.com",
//     "attempts": 1,
//     "escalations": 0,
//     "byte_size": 24589,
//     "is_partial": false,
//     "decision_reason": "ok"
//   },
//   "attempts": ["static:ok"]
// }