How do I let my AI agent buy a gift card through an API?
Last reviewed: August 2026
Call GET /search-gift-cards to find the product’s laso_server_id, then call GET /order-gift-card with an amount and that id, paid in USDC over x402. The response already contains the redemption_code, pin_code, or redemption_url, so there is no polling step and the agent never needs a card number or a merchant account.
Why a gift card suits an agent
A gift card is a bounded purchase. The agent can only spend the face value, the code is delivered in the API response, and it works at merchants that would never accept a stablecoin. That makes it a good first purchase for an agent: the worst case is the amount you chose. The catalog covers 2,000+ brands across categories such as ecommerce, travel, gaming, and streaming.
The two calls
1. Find the product
Search is free and needs only a Bearer token. Call it once with no filters and read the facets object to learn every valid category, currency, and country value, then filter with q.
curl "https://laso.finance/search-gift-cards?q=amazon&country=US" \
-H "Authorization: Bearer $LASO_ID_TOKEN"
# {
# "gift_cards": [{
# "laso_server_id": "amazon",
# "name": "Amazon",
# "currency": "USD",
# "min": 5, "max": 2000, "increment": "0.01",
# "denominations": null
# }],
# "count": 1,
# "facets": { "categories": [...], "currencies": [...], "countries": [...] }
# }
Always copy laso_server_id from a search result. An id that is not in the catalog returns 404 unknown_laso_server_id before any payment is quoted. Honor min, max, and increment, and if denominations is set, only those exact amounts can be ordered.
2. Order it
Without a wallet of its own, the agent orders from a managed wallet with agentX402Pay in route mode. Laso signs and settles the payment, so no private key sits in the agent’s environment.
curl https://laso.finance/agentX402Pay \
-H "Authorization: Bearer $LASO_ID_TOKEN" \
-H "Content-Type: application/json" \
-d '{"data":{
"userId":"usr_...",
"route":"order-gift-card",
"params":{"amount":50,"laso_server_id":"amazon","country":"US"}
}}'
# { "result": { "status": 200, "body": { "gift_card": {
# "card_id": "gc_abc123",
# "amount": 50, "currency": "USD",
# "redemption_code": "XXXX-XXXX-XXXX",
# "pin_code": null, "redemption_url": null,
# "status": "completed"
# } }, "txHash": "..." } }
An agent that already holds its own wallet can call GET /order-gift-card?amount=50&laso_server_id=amazon&country=US directly with an x402 client library. The first request returns a 402 with the exact price, and the client repeats it with the signed payment attached.
Read the result
- Check the inner
statusof theagentX402Payresult, not the HTTP code. Anything outside 200 to 299 means nothing was delivered. - Different brands return different combinations of
redemption_code,pin_code, andredemption_url. Hand the user every field that is not null. txHashconfirms the payment settled. Do not repeat the order after a timeout until you have checked whether the first one completed.
The currency gotcha
amount is the face value in the product’s own currency, not USD. Laso converts it to USD and adds the product fee, typically 4.8% (U.S. Amazon is 0%), and that total is the USDC price. A 100 SAR card costs roughly $28 USDC, not $100. The $5 minimum and $9,000 maximum apply to the converted USD value. Read the product’s currency from the catalog and take the real price from the 402 quote.
Other ways to do it
Laso is not the only catalog an agent can buy from. Bitrefill offers gift cards to agents through an MCP integration and lists crypto, card, and balance payment methods, with OAuth, client credentials, or API keys for access (see Bitrefill for agents). If your agent already has a Bitrefill account, that may be the shorter path. Laso fits when the agent should pay in USDC with no account to create, with the amount capped by the wallet balance and the account spend limit.
If the merchant you need does not sell gift cards, order a prepaid card instead, which works at any checkout that accepts cards.
Full reference: ordering a gift card, paying from the managed wallet, and how x402 works.
Frequently asked questions
Can an AI agent buy a gift card without a human approving each purchase?
Yes. The agent pays from a funded wallet, and the account owner’s per-payment spend limit, which the agent cannot raise, caps any single order.
How does my agent get the gift card code?
It comes back in the order response as redemption_code, pin_code, and/or redemption_url, depending on the brand. There is nothing to poll.
How do I find the right gift card product id?
Call GET /search-gift-cards with q set to the brand name and copy the laso_server_id from the result. Add country to pick a regional variant.
Why did my gift card cost less than the amount I asked for?
The amount is in the product’s own currency. Laso converts it to USD before pricing, so a card in a weaker currency costs fewer USDC than its face value suggests.
What if my agent orders a gift card twice by mistake?
Each order is a separate paid purchase. Check txHash and the account balance before retrying after a timeout, and do not repeat an order that may have completed.
More guides
- How to give your AI agent a credit card — An AI agent cannot pass credit underwriting, but it can issue itself a virtual prepaid card over an API in about a minute. The working pattern, with real requests: x402 payment in, card number out.
- x402 vs AP2 vs ACP vs MPP vs UCP: which should your agent use? — All five agent payment protocols compared honestly: x402 and MPP for machine-to-machine HTTP payments, ACP for ChatGPT checkout, UCP for Google surfaces, AP2 for authorization. Which layer each one is, when to use each, and a worked x402 example.
- x402 vs Stripe Issuing for AI agents — Two real ways to put a card in an AI agent’s hands: Stripe Issuing behind a business account, or x402 card issuance the agent drives itself. An honest comparison of onboarding, funding, controls, and when each wins.
- Issue a virtual card with one x402 call — A complete, runnable walkthrough: pay one x402 request in USDC and receive a virtual prepaid card with number, expiry, and CVV. Real endpoints, real response shapes, error handling included.
- How can an AI agent pay for an API call with USDC? — An AI agent pays for an API call with USDC by answering the API’s HTTP 402 challenge with a signed payment. Two ways to do it: your own wallet with an x402 client, or a managed wallet with a price cap and no private key.
- How do I give an AI agent a bank account? — Two real ways to give an AI agent bank details: a business checking account it can operate (Meow) or a U.S. bank account that converts incoming dollars to USDC in the agent’s wallet (Laso). What each one is, who approves what, and when to pick which.
- How do I cap how much my AI agent can spend? — Cap an AI agent’s spending with limits it cannot raise: a funded balance, a per-payment spend limit set by the account owner, a per-call price cap, and prepaid cards loaded with exactly the amount to spend.
- How do I send money to someone’s debit card from code? — Send USD, EUR, or GBP to a debit card with one API call paid in USDC. No payment processor account: you get a redemption link, the cardholder enters their own card details, and the funds are pushed to the card.
- What are the best ways to pay someone on Venmo or PayPal from an AI agent? — Four ways an AI agent can pay a person on Venmo or PayPal: the PayPal Payouts API, a USDC-paid payout through Laso, a bank or card payout instead, or a human approving each payment. Tradeoffs for each.
- All agent guides, or how Laso compares to the alternatives
Try it: connect a wallet at laso.finance and you'll have a card, gift card, or payout in minutes.
Building an agent? Point it at laso.finance/SKILL.md — it can set itself up.