1. Set up your agent’s wallet
Your agent needs a crypto wallet with USDC on Base to pay for Laso Finance API calls. Choose a wallet provider:
Locus provides wallet infrastructure purpose-built for AI agents.Tell your agent:Read https://paywithlocus.com/SKILL.md and follow the instructions to set up Locus
Your agent will walk through the Locus onboarding, but it needs a few things from you first:Deploy a wallet
From the dashboard, click Create Wallet. This deploys a smart wallet on the Base blockchain (~30 seconds). Save your private key — it’s shown only once.
Fund your wallet
Transfer USDC on the Base chain to the wallet address shown on your dashboard. You’ll need at least $5 to order a card.
Generate an API key
Go to the API Key section and generate a key (starts with claw_). Copy it immediately — it’s shown only once.
Configure x402 endpoints
Navigate to x402 Endpoints in the Locus dashboard and add the Laso Finance endpoints your agent will use. See the Locus x402 Configuration guide for detailed instructions on adding each endpoint with the correct parameters.This step is required! Without configuring the x402 endpoints, your agent won’t be able to call Laso Finance APIs through Locus.
Give your agent the API key
When your agent asks for a Locus API key, provide the claw_ key you generated.
Sponge provides agent wallets with automatic x402 service discovery.Tell your agent:Read https://wallet.paysponge.com/skill.md and follow the instructions to set up Sponge Wallet
Your agent will walk through the Sponge onboarding, but it needs a few things from you first:Agent registers
Your agent calls POST /api/agents/register with agentFirst: true to get an API key immediately (starts with sponge_live_). A claim URL is returned for human verification.
Claim the wallet
Open the claim URL from the registration response to verify and take ownership of the wallet.
Fund your wallet
Transfer USDC on the Base chain to the wallet address. You’ll need at least $5 to order a card.
Discover Laso Finance endpoints
Sponge discovers x402 services automatically. Your agent calls GET /api/discover?query=laso to find available Laso Finance endpoints, then uses POST /api/x402/fetch to call them. No manual endpoint configuration needed.
2. Order a card
Once your agent has a funded wallet, it can call the Laso Finance /get-card endpoint. The x402 protocol handles the payment flow automatically.
import { wrapAxios } from "x402-axios";
import axios from "axios";
const client = wrapAxios(axios, wallet);
const { data } = await client.get("https://laso.finance/get-card", {
params: { amount: 50 },
});
const { auth, card } = data;
// card.card_id — use this to poll for card details
// auth.id_token — use this for authenticated requests
The response includes:
auth.id_token and auth.refresh_token for authenticated API calls
card.card_id with status: "pending"
3. Poll for card details
Card details (number, CVV, expiry) take ~7-10 seconds to become available. Poll /get-card-data until status is "ready".
async function waitForCard(idToken, cardId) {
while (true) {
const { data } = await axios.get("https://laso.finance/get-card-data", {
params: { card_id: cardId },
headers: { Authorization: `Bearer ${idToken}` },
});
if (data.status === "ready") {
return data.card_details;
}
await new Promise((r) => setTimeout(r, 3000));
}
}
const cardDetails = await waitForCard(auth.id_token, card.card_id);
// cardDetails.card_number
// cardDetails.cvv
// cardDetails.exp_month / cardDetails.exp_year
// cardDetails.available_balance
4. Use the card
You now have a prepaid card. Use the card number, CVV, and expiry to make purchases at any US-based merchant.
Cards are US only. They can only be used at US-based merchants for USD
purchases. Physical goods must ship to a US address.
Full example
import { wrapAxios } from "x402-axios";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";
import axios from "axios";
// Set up wallet with your private key
const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const wallet = createWalletClient({
account,
chain: base,
transport: http(),
});
// Wrap axios with x402 payment handling
const client = wrapAxios(axios, wallet);
// Order a $50 prepaid card
const { data } = await client.get("https://laso.finance/get-card", {
params: { amount: 50 },
});
const { auth, card } = data;
// Poll until card details are ready
let cardDetails;
while (!cardDetails) {
const res = await axios.get("https://laso.finance/get-card-data", {
params: { card_id: card.card_id },
headers: { Authorization: `Bearer ${auth.id_token}` },
});
if (res.data.status === "ready") {
cardDetails = res.data.card_details;
} else {
await new Promise((r) => setTimeout(r, 3000));
}
}
console.log("Card ready:", cardDetails);
Cards are non-reloadable. If you’re making an online purchase, ideally order a
card for the exact checkout total so no funds are left over on the card.