laso

← All agent guides

How do I let my AI agent buy a gift card through an API?

Last reviewed: August 2026

The short answer

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

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

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.