How Do I Pay for a SaaS Review With Crypto (x402) in Python?
x402 lets an AI agent pay for a review in stablecoin with no account or card. Here is the exact Python to order, pay, and poll, plus a prompt an agent can run on its own.
//Full API reference
This post covers the payment flow. For every endpoint with its parameters and response shapes, see the Agent API docs.
To pay for a saasreview review with x402 in Python, POST to https://saasreview.ai/api/x402/reviews to get a pay URL, GET that URL to receive an HTTP 402 challenge with a USDC deposit address on Base, then use an x402 client and a funded wallet to send the exact amount and retry the request with an X-PAYMENT header. A 200 with paid: true returns a poll URL for the finished review.
What is x402, and why would an agent use it?
x402 is an open protocol for machine payments over plain HTTP. When a client requests a paid resource, the server answers with HTTP 402 Payment Required and the payment details. The client pays, then retries the request with proof of payment. It lets an agent pay per call in stablecoin without an account or a saved card, which is exactly what an autonomous agent needs. The spec lives at x402.org.
What does the x402 payment flow look like, step by step?
- 1.POST the order to
/api/x402/reviews. The response has apay_url. - 2.GET the
pay_urlwith no payment. You get HTTP 402 and a challenge that names the deposit address (payTo), the network, the token, and the exact amount in USDC base units. - 3.Send that exact USDC amount to
payToon the given network, then retry thepay_urlwith anX-PAYMENTheader holding the payment payload. - 4.On success you get 200 with
paid: trueand apoll_url. Poll it until the review is ready.
Step 1: order the review and get a pay URL
curl -X POST https://saasreview.ai/api/x402/reviews \
-H 'Content-Type: application/json' \
-d '{"product_url":"https://your-app.com","tier":"ai","contact_email":"founder@your-app.com"}'
# -> { "submission_id": "...", "price_usd": 5.0,
# "payment": { "type": "x402", "pay_url": "/api/x402/reviews/<id>/pay" },
# "poll_url": "/api/agent/reviews/<id>" }Step 2: read the HTTP 402 payment challenge
GET the pay URL with no payment. The server replies with HTTP 402 and an x402 challenge. The accepts list tells you where to pay, on which network, in which token, and how much. Amounts are in USDC base units, where one US cent is 10,000 units (USDC has six decimals).
GET https://saasreview.ai/api/x402/reviews/<id>/pay -> HTTP 402
{
"x402Version": 1,
"error": "X-PAYMENT header required",
"accepts": [
{
"scheme": "exact",
"network": "base",
"maxAmountRequired": "50000", // 50000 base units = $0.05 USDC
"payTo": "0x...deposit-address...", // send USDC here
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // USDC on Base
"resource": "https://saasreview.ai/api/x402/reviews/<id>/pay"
}
]
}The exact Python script to order, pay, and poll
This script orders the review, lets an x402 client pay the 402 challenge from your wallet, and then polls for the result. The saasreview calls are exact. The payment line uses an x402 client, which signs and sends the USDC and rebuilds the X-PAYMENT header for you. The exact client name depends on the x402 package you install, so check x402.org for the current one.
import os, time, httpx
from eth_account import Account # pip install eth-account
from x402.clients.httpx import x402_payment_hooks # pip install x402 ; name varies by version, see x402.org
BASE = "https://saasreview.ai"
# A funded wallet holding USDC on Base. Read the key from the environment, never hardcode it.
account = Account.from_key(os.environ["AGENT_WALLET_PRIVATE_KEY"])
# An httpx client that auto-pays any HTTP 402 it receives, from the wallet above.
client = httpx.Client(base_url=BASE, event_hooks=x402_payment_hooks(account))
# 1. Order the review (no payment yet).
order = client.post("/api/x402/reviews", json={
"product_url": "https://your-app.com",
"tier": "ai", # ai $5, human $15, human_plus_plan $25, pentest $30
"contact_email": "founder@your-app.com",
}).json()
# 2. Pay: GET the pay_url. The hook sees the 402, sends the exact USDC on Base,
# and retries with the X-PAYMENT header. You get back {paid: true, poll_url}.
paid = client.get(order["payment"]["pay_url"]).json()
print("paid:", paid["paid"])
# 3. Poll until the review is published (a real person checks every published one).
while True:
r = httpx.get(f"{BASE}/api/agent/reviews/{order['submission_id']}").json()
if r.get("status") == "rejected":
print("not published")
break
review = r.get("review")
if review and review.get("published"):
print(review["composite_score"], "-", review["verdict"])
print(review["url"])
break
time.sleep(15)//What you need to pay
A wallet funded with USDC on Base, and its private key in the AGENT_WALLET_PRIVATE_KEY environment variable. Never put a private key in source code. Confirm the amount in the 402 challenge before paying.
The prompt to make an agent write this script itself
If you want an agent to generate and run the payment script on its own, give it this prompt. It carries the exact contract, so the agent does not have to guess the endpoints or the shape of the challenge.
You are an autonomous agent with a funded crypto wallet (USDC on Base). Write and run a
Python script that orders a paid SaaS review from saasreview and pays for it with x402,
then prints the finished review. Follow this contract exactly:
1. Read https://saasreview.ai/api/agent/catalog for the live tiers and prices.
2. POST https://saasreview.ai/api/x402/reviews
body: {"product_url": "<URL to review>", "tier": "ai", "contact_email": "<email>"}
-> returns {"submission_id": ..., "payment": {"pay_url": "/api/x402/reviews/<id>/pay"}}
3. GET https://saasreview.ai<pay_url> with no payment to read the HTTP 402 challenge.
accepts[0] = {scheme:"exact", network, maxAmountRequired (USDC base units),
payTo (deposit address), asset (USDC contract)}.
Use an x402 client from https://x402.org and the wallet key in env AGENT_WALLET_PRIVATE_KEY
to send the exact USDC on Base and retry the GET with an X-PAYMENT header.
A 200 {"paid": true, "poll_url": ...} means it worked.
4. Poll https://saasreview.ai/api/agent/reviews/<submission_id> every 15 seconds until
review.published is true (a real person checks every published one; the status ends published or rejected),
then print review.composite_score, review.verdict, review.url.
Rules: keep the wallet key only in the environment, never in code. Print the amount from
the 402 challenge and confirm it is what you expect before paying. Stop after one review.What does the agent get back when it is paid?
Once payment clears, the order is queued and a review is generated. Polling returns the status, and when it is ready the review object carries a composite score out of ten, a plain-language verdict, and the public URL. For the full set of endpoints, see how an AI agent orders a SaaS review with an API.
Order a review for any URL and pay with x402 in a few lines of Python. The catalog has the live tiers and prices, and reviews are independent and labeled as paid.
Read the agent API guideFrequently asked questions
How does an AI agent pay for a service with x402? ▾
The agent requests a paid resource and gets back HTTP 402 with payment details: a deposit address, a network, a token, and an amount. It sends the exact amount, then retries the request with an X-PAYMENT header that proves payment. For saasreview, POST to /api/x402/reviews to get a pay URL, then pay it. No account or card is needed.
What network and token does saasreview accept for x402? ▾
USDC on Base. The HTTP 402 challenge returns the USDC contract address as the asset and a deposit address as payTo, with the amount in USDC base units (one US cent is 10,000 units, since USDC has six decimals). Send the exact amount to that address on Base, then retry with the X-PAYMENT header.
Do I need a crypto wallet to pay with x402? ▾
Yes. You need a wallet funded with USDC on Base, and its private key available to your x402 client (for example in the AGENT_WALLET_PRIVATE_KEY environment variable, never in source code). The x402 client uses the wallet to send the payment and build the X-PAYMENT header automatically.
What is the X-PAYMENT header? ▾
It is the HTTP header an x402 client adds when it retries a paid request after paying. It carries a base64-encoded payment payload that proves the on-chain transfer to the server. The server verifies it and then returns the resource, in our case a 200 with paid true and a poll URL for the review.
Can an AI agent pay for a review fully autonomously? ▾
Yes, if it has a funded USDC wallet on Base. Give it the prompt in this guide, which carries the exact endpoints and the shape of the 402 challenge, and it can write and run a Python script that orders the review, pays with x402, and polls for the result without a human.
Let an agent pay for a review by itself
x402 lets an AI agent pay per review in stablecoin on Base, no account or card. Order, pay, and poll in a few lines of Python.
Read the agent API guideKeep reading
How Can an AI Agent Order a SaaS Review With an API?
saasreview has an API built for AI agents. Here is how an agent discovers the catalog, orders a review for any URL, pays by card or in stablecoin, and reads the result.
How Do I Get My App Recommended by ChatGPT?
When people ask AI assistants for a tool like yours, you want to be one of the answers. Here is how AI tools find and recommend apps, and how to make yours easy to cite.
How do I make my pricing readable by AI?
If an AI assistant cannot parse your pricing, it cannot tell a buyer what you cost. Here is how to publish pricing that both people and AI tools can read cleanly.
We put every SaaS through the same honest scorecard, then publish the result.