agentX402Pay settles an x402 payment from the managed wallet and returns the endpoint’s own response. It works in two modes: route for Laso’s endpoints, url for anyone else’s.
Set up the wallet first in the overview.
Pay a Laso route
route values: get-card, order-gift-card, order-intl-card, get-push-to-card, send-payment. Free endpoints are not routes; call those directly with your Bearer token.
Pay an external x402 endpoint
note in url mode: one sentence on why you are paying and who it is for. It is shown next to the charge in the owner’s activity feed. Notes over 300 characters are truncated. note is refused with route, since Laso purchases are already labeled.
Request options
Both modes accept:Read the response
The endpoint’s response comes back wrapped:txHash is the Solana signature of the payment that settled, the same field name agentWalletTransfer returns. It is present whenever a payment settled and absent when nothing was paid.
Confirm a payment with
txHash, not with a balance read. The wallet
balance that getAgentWallet reports is updated by a chain webhook and can
trail a settled payment by up to a minute. An unchanged balance right after a
200 does not mean the payment failed.result.error is one sentence naming the host, status, and reason, normalized from whatever field the service used.
Before signing anything, agentX402Pay compares the wallet’s on-chain USDC balance to the price in the 402 challenge. An underfunded payment comes back as an inner 402 whose body is the standard x402 settlement-failure shape with errorReason: "insufficient_funds", and nothing is signed:
body.errorReason. settlement_failed is reserved for a payment that was signed but could not settle on-chain for another reason.
An inner 402 almost always means the wallet could not cover the total. Laso fees are charged on top of the amount you request, so a wallet holding exactly $2,000 cannot send a $2,000 bank payment (it costs $2,005.00). Nothing is charged for a failed payment, so retrying with a smaller amount is safe.
Move funds out
agentWalletTransfer sends USDC from the managed wallet to any Solana address.
{ "result": { "transferId": "...", "txHash": "...", "destinationAddress": "..." } }.
Next steps
Guardrails
Refuse any external challenge that does not match what you agreed to pay.
Making a purchase
The two-step card flow you reach through
agentX402Pay.