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
| Scenario | Recommended tool |
|---|---|
| You want to fetch a URL and let Nebula handle any 402 automatically | x402_fetch |
| You have already received a 402 response and parsed the exact price | x402_pay |
| You are building a custom payment flow that inspects 402 challenges | x402_pay |
x402_fetch is simpler. Reach for x402_pay only when your agent is explicitly orchestrating a multi-step payment negotiation.
Parameters
The URL of the x402-gated resource you are paying for. This should match the URL from the original 402 challenge.
The exact USDC amount to pay, as specified in the 402 challenge. Must be a positive finite number.
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
Always
"ok" on success.The Stellar transaction hash confirming the on-chain payment.
The USDC amount that was paid.
The Stellar address of the resource owner who received the payment.
The facilitator address used for this payment, if applicable.
Error
Error response
Policy interaction
Likex402_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
Response