x402 Billing
How pay-per-request billing works. USDC wallet setup, the 402 flow, fiat top-up via Stripe, and tier pricing recap.
HTTP 402 protocol overview
x402 is an open protocol that restores the original meaning of HTTP 402 Payment Required. When your agent makes a DataCork API request that incurs a charge:
- DataCork returns HTTP 402 with a payment quote in the response.
- Your agent reads the quote, signs a USDC payment, and retries the request with a
X-Paymentheader. - DataCork verifies the payment on Base network and fulfills the request.
Total round-trip overhead: <200ms on the retry leg. The protocol is stateless — no session cookie, no pre-auth required.
Sample 402 response
HTTP/1.1 402 Payment Required
Content-Type: application/json
X-Payment-Version: x402/1.0
X-Payment-Quote: {
"amount": "0.001",
"currency": "USDC",
"network": "base-mainnet",
"recipient": "0xDataCork...",
"quote_id": "q_01hx...",
"expires_at": "2026-04-27T18:35:00Z",
"payload_hash": "sha256:abc..."
}
{
"error": "payment_required",
"message": "This endpoint requires a USDC payment. Retry with X-Payment header.",
"quote_id": "q_01hx..."
}
Retry with payment
# Python — using the x402 client library (recommended)
from x402 import X402Client
from datacork import DataCorkClient
dc = DataCorkClient(wallet=X402Client(private_key=os.environ["WALLET_KEY"]))
# Client handles 402 → sign → retry automatically
session = dc.vpn.connect(country="DE")
# Manual approach (curl)
# 1. Get quote:
QUOTE=$(curl -sI https://api.datacork.com/v1/vpn/connect \
-X POST -d '{"country":"DE"}' | grep X-Payment-Quote)
# 2. Sign and retry:
curl -X POST https://api.datacork.com/v1/vpn/connect \
-H "X-Payment: $(sign_quote $QUOTE)" \
-d '{"country":"DE"}'
USDC wallet setup
DataCork uses Coinbase Developer Platform (CDP) wallets on the Base network. To set up:
- Install Coinbase Wallet or connect any EIP-1193 compatible wallet.
- Bridge USDC to Base at bridge.base.org (also available via Coinbase exchange directly to Base).
- Register your wallet address in the DataCork dashboard under Billing → Wallet.
- DataCork will send a verification transaction of $0.001 USDC; confirm it to link the wallet.
Minimum balance: We recommend keeping at least $5 USDC on Base for smooth operation. DataCork will send you an email when your balance drops below $1.
Fiat top-up via Stripe
Prefer not to hold crypto? Top up a DataCork credit balance instead:
- Go to Billing → Credits in the dashboard.
- Click "Top up with card" — accepts Visa, Mastercard, Amex, ACH (US), SEPA (EU).
- Credits are applied immediately and consumed in place of USDC payments.
- Minimum top-up: $5. No maximum. Credits don't expire.
Credits and USDC coexist in the same account. DataCork tries credits first, then falls back to USDC if credits are exhausted.
Tier pricing recap
See the full pricing page for details. Summary:
- Free: 1,000 x402 tx/mo pre-authorized (no payment). Overage blocks.
- Pro ($8/user/mo): 100,000 tx/mo. Overage $0.001/tx. Egress $0.008/GB.
- Team ($15/user/mo): 1,000,000 tx/mo. Overage $0.0005/tx. Egress $0.005/GB.
- Business ($29/user/mo): Unlimited tx. Egress $0.002/GB. No overage.