Payment Flow Guide
ASG Agent Cloud uses a 2-step payment flow based on the HTTP 402 Payment Required standard. This guide shows you exactly how it works with copy-paste curl examples.How It Works
Step 1: Request a Quote
Call any billable tool without a payment proof. The gateway returns a402 Payment Required response with a quote and payment instructions.
402 Response
Step 2: Pay and Retry
After sending USDC on Solana mainnet, retry the same tool call with your payment proof attached. ASG supports two methods:Method A: Body payment_proof (Primary)
Include the payment proof directly in the request body:
Method B: X-Payment Header (x402 Standard)
Encode the payment proof as base64 JSON and pass it in the X-Payment header:
Success Response (200)
Field Reference
Idempotency
Always include an
idempotency_key with your payment proof. If a request is retried with the same key, ASG returns the cached result without charging again. This prevents double-billing on network errors.Error Handling
Next Steps
Tool Availability
See which tools are currently active
Billing Overview
Understand the billing model
SDK Examples
TypeScript examples with payment flow
Payment Contract
Full technical payment contract reference