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.
Endpoints that settle on Base
An endpoint that settles in USDC on Base mainnet (networkeip155:8453, or base in x402 v1) is paid the same way as a Solana one, from the same balance. Nothing needs setting up first:
- The payment is signed from the account’s Base wallet.
- If the Base side cannot cover the price, Laso moves what is needed over from Solana before signing. This usually adds under 10 seconds and costs 0.075% of the amount moved.
- No ETH is needed for gas: the payment is a signed USDC authorization that the endpoint’s facilitator submits.
- Other EVM networks are refused.
expectedNetwork to choose: eip155:8453 for Base, solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp for Solana. USDC on Base is 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 for expectedAsset. The same spend limit, guardrails, and funds check apply on Base. Laso routes are paid on Solana; if the Solana side cannot cover one, the difference is pulled back from Base first, so USDC on either side pays for them.
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, or the Base transaction hash for a payment made from the Base wallet. It is the same field name agentWalletTransfer returns, 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, Solana and Base together, 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. A Base payment gets the same check and the same shape. If moving funds to Base fails or takes longer than 45 seconds, the call fails with unavailable and nothing is paid to the endpoint; retry it.
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, or to any USDC address on Base. It draws on the whole balance: if the Solana side is short, the difference is pulled back from Base first, which usually adds about 15 seconds.
{ "result": { "transferId": "...", "txHash": "...", "destinationAddress": "...", "destinationNetwork": "solana" } }.
Sending to Base
SetdestinationNetwork to "base" and pass a 0x address. The managed wallet is a Solana wallet, so Laso bridges the USDC to Base over CCTP and it arrives as native USDC at the address you gave.
txHashis the Solana transaction that took the USDC out of the managed wallet, not the Base delivery. The USDC usually lands on Base within a minute of it confirming.- The minimum is $1.00, and the maximum is your account’s spend limit per payment.
- The recipient receives the amount less the bridge’s 0.01% fee ($5.00 arrives as $4.9995).
- If the bridge fails, nothing is burned and the amount is credited to your Laso account balance instead. Withdraw it with
/withdrawor retry.
Other tokens in the wallet
The managed wallet can receive any Solana token, so someone may fund it with USDT or SOL instead of USDC. Payments spend USDC only.getAgentWallet lists everything the wallet holds under tokens, each with mint (native for SOL), symbol, amount, and usd_value.
Swap it to USDC with agentWalletSwap. No SOL is needed for fees, and the rate includes a provider fee of up to 0.25% plus the pool’s own fee. slippageBps caps how far the fill may land from the quote (default 50, maximum 300).
{ "result": { "swapId": "...", "status": "succeeded", "fromSymbol": "USDT", "toSymbol": "USDC", "inputAmount": 10, "outputAmount": 9.966, "txHash": "..." } }. If the swap is still settling after 45 seconds, status is pending. Swaps keep the money in the wallet, so they do not count against your spend limits.
toMint can be any token. searchSwapTokens finds one by symbol, name, or mint and marks whether it is verified; an unverified token is often a copy of a real one, so check its mint before buying. agentWalletSwapQuote takes the same fields as the swap and returns the estimated and minimum output and each side’s dollar value without swapping anything.
Send it as is with agentWalletTransfer and the token’s mint. amount is in the token’s own units and the destination must be a Solana address. The send is valued at the token’s market price for your spend limits. If the recipient has no account for that token yet, creating one costs a small rent fee charged in USDC on top.
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.