Skip to main content
x402_pay makes a direct USDC payment to an x402-gated resource when you already know the exact amount required. This is typically used after your agent has already received and parsed an HTTP 402 challenge and has extracted the price and facilitator address from it. Unlike x402_fetch, this tool does not issue a preliminary GET request — it goes straight to payment.

When to use x402_pay vs x402_fetch

ScenarioRecommended tool
You want to fetch a URL and let Nebula handle any 402 automaticallyx402_fetch
You have already received a 402 response and parsed the exact pricex402_pay
You are building a custom payment flow that inspects 402 challengesx402_pay
In most cases, x402_fetch is simpler. Reach for x402_pay only when your agent is explicitly orchestrating a multi-step payment negotiation.

Parameters

url
string
required
The URL of the x402-gated resource you are paying for. This should match the URL from the original 402 challenge.
amount_usdc
number
required
The exact USDC amount to pay, as specified in the 402 challenge. Must be a positive finite number.
facilitator
string
The facilitator address extracted from the 402 challenge header. Facilitators route and attest payments on behalf of the payee. When provided, the Hub includes this address in the payment envelope. When omitted, the Hub uses its default facilitator.

Response

Success

Success response
{
  "status": "ok",
  "data": {
    "tx_hash": "f71c4a9...b330",
    "amount_paid_usdc": 0.25,
    "payee": "GBKUD4NQFPZ4TPIJCZ5YGZQ5K4XQZBLK7RQFVTX7QWZLOEXAMPLEADDR",
    "facilitator": "GFACILITATOREXAMPLEADDRESSSTELLAR7QWZLOEXAMPLEADDR"
  }
}
status
string
Always "ok" on success.
data.tx_hash
string
The Stellar transaction hash confirming the on-chain payment.
data.amount_paid_usdc
number
The USDC amount that was paid.
data.payee
string
The Stellar address of the resource owner who received the payment.
data.facilitator
string
The facilitator address used for this payment, if applicable.

Error

Error response
{
  "status": "error",
  "reason": "Insufficient USDC balance: have 0.10, need 0.25"
}

Policy interaction

Like x402_fetch, payments submitted via x402_pay count toward your per-transaction and daily USDC spend caps. The Hub validates the requested amount_usdc against your active policy before broadcasting the transaction.

Example

Tool call
{
  "tool": "x402_pay",
  "input": {
    "url": "https://api.example.com/premium-report",
    "amount_usdc": 0.25,
    "facilitator": "GFACILITATOREXAMPLEADDRESSSTELLAR7QWZLOEXAMPLEADDR"
  }
}
Response
{
  "status": "ok",
  "data": {
    "tx_hash": "f71c4a9b2e3d...b330",
    "amount_paid_usdc": 0.25,
    "payee": "GBKUD4NQFPZ4TPIJCZ5YGZQ5K4XQZBLK7RQFVTX7QWZLOEXAMPLEADDR",
    "facilitator": "GFACILITATOREXAMPLEADDRESSSTELLAR7QWZLOEXAMPLEADDR"
  }
}