From a live x402 API to a Pyrimid-listed paid product.
Validate the payment contract first, publish enough metadata for buyer agents to decide, and name Pyrimid only after catalog and onchain routing evidence exists.
Updated July 18, 2026
Keep the two layers separate
- x402 defines the HTTP 402 challenge and paid retry.
- Pyrimid adds catalog discovery and optional affiliate-aware routing on Base.
Bincrease currently demonstrates the first layer. This guide does not call it a Pyrimid-listed product or claim a routed sale that has not happened.
1. Start with one bounded operation
The live example removes duplicate rows from bounded UTF-8 CSV input. It has a fixed 0.10-native-USDC price, an explicit schema, and deterministic output another agent can evaluate.
curl --silent --show-error \
--dump-header /tmp/bincrease-headers.txt \
--output /tmp/bincrease-body.json \
--request POST \
'https://bincrease.vercel.app/api/x402/csv-dedupe' \
--header 'content-type: application/json' \
--data '{
"csv":"email,region\nAlice@example.com,EU\nalice@example.com,US\n",
"keyColumns":["email"],
"keep":"first",
"trim":true,
"caseSensitive":false
}'Expected status: 402 Payment Required. This probe sends no wallet, signature, payment header, or transaction.
2. Decode and compare the challenge
An x402 v2 seller publishes a base64-encoded PAYMENT-REQUIRED header. Decode it before submitting the operation to a directory.
awk 'BEGIN { IGNORECASE=1 } /^payment-required:/ {
sub(/^[^:]+:[[:space:]]*/, "");
gsub(/\r/, "");
print
}' /tmp/bincrease-headers.txt | base64 --decode | jq '{
x402Version,
resource: .resource.url,
accepts: [.accepts[] | {
scheme, network, asset, amount, payTo
}]
}'| Field | Required value |
|---|---|
| x402Version | 2 |
| scheme | exact |
| network | eip155:8453 |
| asset | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
| amount | 100000 base units |
| resource.url | https://bincrease.vercel.app/api/x402/csv-dedupe |
The asset is Circle native USDC on Base. A similarly named token, testnet token, or different recipient is not equivalent.
3. Publish catalog-ready metadata
Buyers need the method, endpoint, six-decimal price, input and output schemas, network, and asset without scraping marketing copy. Bincrease publishes the complete contract in its OpenAPI document and developer documentation. Keep the product ID stable because directories and receipt ledgers may cache it.
4. Add Pyrimid only when the routing is real
Pyrimid's current vendor quickstartdefines four additional actions: register a vendor, list the product, gate the endpoint with the SDK, and route the buyer's USDC through PyrimidRouter. Its public catalog can be inspected without a wallet:
curl --silent --show-error \
'https://pyrimid.ai/api/v1/catalog?source=pyrimid-seed' \
| jq '.products[]
| select(.product_id == "vendor-lead-discovery")
| {
vendor_id, product_id, endpoint, method,
price_usdc, affiliate_bps, network, asset,
output_schema
}'A JSON object that merely resembles a Pyrimid record is not proof of integration. Require a catalog record, the documented unpaid challenge, a real routed buyer payment, an independently visible PaymentRouted event and USDC transfers, the paid result, and the expected vendor receipt.
5. Give buyers a reproducible runbook
- Discover the catalog entry.
- Validate method, schema, price, network, and asset.
- Call without payment and compare the 402 challenge with the catalog.
- Authorize no more than the declared price and route the payment.
- Retry with proof, validate the output schema, and hash the result.
- Record the transaction hash, product ID, result hash, and seller receipt.
Never log private keys, seed phrases, raw signed payloads, or reusable payment headers. Count revenue only after the seller's exact USDC receipt is independently confirmed.
Seller checklist
- The unpaid request returns HTTP 402 with x402 v2 metadata.
- Method, URL, price, network, asset, and recipient match every manifest.
- Input limits and output schema are explicit.
- Invalid input fails before expensive work runs.
- The paid result is deterministic or contains checkable evidence.
- Pyrimid is named only after catalog and onchain routing evidence exists.