Machine Payments (MPP)
Let AI agents top up credits on their own. Agents buy credit packs programmatically over HTTP 402 using the Machine Payments Protocol — no checkout page, no card form, no human in the loop. Credits land on the team behind the caller's x-api-key, so every scraping endpoint keeps working exactly as before.
How it works
- The agent requests to buy a pack. With no payment credential, the endpoint replies with an HTTP 402 Payment Required challenge (
WWW-Authenticate: Payment) listing the accepted payment methods. - The agent's MPP client pays the challenge and retries the request with a payment credential in the
Authorizationheader. - The server verifies the payment and grants the pack's credits to the team behind the
x-api-key, exactly once, returning the new balance.
Credits are always derived from the verified payment amount, never from the request — so the pack a caller receives always matches what they actually paid.
Accepted payment methods
The 402 challenge offers two rails. An agent can pay with either:
| Rail | What you pay with | Notes |
|---|---|---|
Cryptotempo / charge | USDC on the Tempo network (pathUSD on Tempo testnet) | On-chain stablecoin, near-zero fees. Offered when the crypto rail is available. |
Fiatstripe / charge | Stripe Shared Payment Token — card or Link | No crypto wallet needed. Always offered. |
The easiest client is mppx, which speaks both rails and handles the whole 402 challenge → pay → retry loop for you. Pick the crypto or card section below depending on which wallet the agent has.
Credit packs
| Pack | Credits | Price (USD) |
|---|---|---|
freelance | 25,000 | $47 |
business | 500,000 | $497 |
Packs are fixed — the price you pay determines the pack you get, so there's no way to under- or over-pay for credits.
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /mpp/packs | List available credit packs (no payment required). |
| POST | /mpp/buy-credits?pack=<pack> | Returns a 402 challenge; on payment, grants the pack's credits. |
Base URL: https://api.scrapecreators.com
List the packs
curl --request GET \
--url https://api.scrapecreators.com/mpp/packs \
--header "x-api-key: YOUR_API_KEY"Pay with crypto (USDC on Tempo)
The mppx CLI ships with a built-in Tempo wallet. Create an account once, then point it at the endpoint — it reads the 402 challenge, pays in USDC, and retries automatically.
- Create a wallet (stored in your OS keychain):
npx mppx account create - On testnet, fund it from the faucet (mainnet wallets must hold real USDC):
npx mppx account fund --network testnet - Buy a pack:
npx mppx "https://api.scrapecreators.com/mpp/buy-credits?pack=freelance" \ -X POST \ -H "x-api-key: YOUR_API_KEY"
Pay with card or Link (Stripe)
No crypto required. There are two ways to pay the fiat rail: let mppx mint a Shared Payment Token from a Stripe payment method, or use Stripe's link-cli wallet with human approval.
Option A — mppx with a Stripe payment method
Provide the payer's Stripe secret key and a saved payment method (pm_…). mppx mints a one-time Shared Payment Token scoped to the pack amount and pays with it. Use --currency usd to select the card rail.
export MPPX_STRIPE_SECRET_KEY=sk_live_... # the payer's Stripe key
npx mppx "https://api.scrapecreators.com/mpp/buy-credits?pack=freelance" \
-X POST \
-H "x-api-key: YOUR_API_KEY" \
--currency usd \
-M paymentMethod=pm_xxxOption B — Stripe link-cli (Link wallet)
Pay from a card or bank account saved to a US Link account, approving each spend in the Link app.
- Create a one-time Shared Payment Token for the pack amount in cents (
4700forfreelance,49700forbusiness) and approve it in the Link app:link-cli spend-request create \ --amount 4700 \ --credential-type shared_payment_token \ --context "Buying Scrape Creators credits via MPP" \ --request-approval - Pay the endpoint with the approved spend request:
link-cli mpp pay "https://api.scrapecreators.com/mpp/buy-credits?pack=freelance" \ --spend-request-id lsrq_xxx \ --method POST \ --header "x-api-key: YOUR_API_KEY"
Pay from agent code
To bake payments into an agent, use the mppx client SDK. Once configured, the global fetch handles 402 challenges automatically:
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'
Mppx.create({
methods: [tempo({ account: privateKeyToAccount(process.env.PRIVATE_KEY) })],
})
// global fetch now settles 402 payments on its own
const response = await fetch(
"https://api.scrapecreators.com/mpp/buy-credits?pack=freelance",
{ method: "POST", headers: { "x-api-key": process.env.SCRAPECREATORS_API_KEY } },
)
const result = await response.json()Success response
On success you get back the granted credits and new balance:
{
"success": true,
"pack": "freelance",
"credits_added": 25000,
"credits_remaining": 274038,
"team_id": "..."
}Notes
- Credits are added to the team behind the
x-api-key— the same balance your regular API calls draw from. - Each 402 challenge is single-use. If a payment fails, request a new challenge (call again without the
Authorizationheader); don't replay an old credential. - The crypto rail is only offered when it's available on the server. If you only see the Stripe method in the challenge, pay with card/Link.
- The
link-clipath (Option B) requires a US Link account. Option A mints the Shared Payment Token directly from a Stripe payment method, so it doesn't.
