·5 min read

How to Use AgentCard with Claude Code for Autonomous Purchases

Give Claude Code a virtual card and let it buy things autonomously. Step-by-step setup for using AgentCard with Anthropic's CLI coding agent.

Claude Code is Anthropic's CLI coding agent — it runs in your terminal, executes shell commands, edits files, and handles multi-step tasks autonomously. We actually built AgentCard using Claude Code, so this integration is close to our hearts.

Because Claude Code has direct terminal access, it can run the entire flow — create a card, grab the details, make a purchase — no manual handoff. Here's the setup.

What you need

  • Claude Code installed (requires a Claude Max, Team, or Enterprise plan)
  • Node.js 18+ for the AgentCard CLI
  • A payment method (credit card, debit card, or USDC)

Why Claude Code works well with AgentCard

Claude Code runs shell commands in your terminal. No context switching. Say "buy API credits" and it creates a card, grabs the credentials, makes the purchase. One session, done.

It also supports MCP (Model Context Protocol), which is a big deal. Point it at our skill endpoint at agentcard.ai/skill and Claude Code learns the CLI on its own. You don't have to teach it anything.

Step 1: Install the AgentCard CLI

You can install it yourself or just ask Claude Code to do it:

npm install -g agentcard

Step 2: Sign up

agentcard signup --email you@example.com

Magic link hits your inbox. Click it. That's the only manual step in the whole flow — we're working on eliminating it too.

Step 3: Create a virtual card

agentcard create --amount 25

Stripe Checkout opens. Pay with a credit card or USDC. About 4 seconds later, you've got a virtual Visa with a hard $25 limit. Nothing more can ever be charged to it. Period.

Step 4: Let Claude Code take over

Once the card exists, Claude Code can handle everything else. It retrieves the card details:

agentcard details <card-id>

Card number, CVV, expiry, billing address — all returned. Claude Code holds these in context and uses them to complete purchases programmatically. API calls, card-on-file setups, whatever the merchant supports.

It can also check the remaining balance at any time:

agentcard balance <card-id>

Want the unspent balance back? Easy:

agentcard refund <card-id> --amount 10

Example workflows

Buying API credits

"Create a $50 AgentCard and use it to buy OpenAI API credits for my account."

Claude Code creates the card, grabs details, hits the OpenAI billing API, and adds the card. Fixed balance means it physically cannot spend more than $50 — even if everything else goes wrong.

Registering a domain

"Create a $15 AgentCard and register mycoolproject.dev on Namecheap."

Claude Code creates the card, gets the credentials, and uses the Namecheap API to search for the domain, add it to a cart, and complete checkout with the virtual card details.

Paying for SaaS tools

"Create a $20 AgentCard and subscribe to the Postmark starter plan for sending transactional emails."

Claude Code handles signup and payment. And here's a nice side effect: since the card has a $20 limit, renewal charges get declined automatically. No surprise recurring bills.

Provisioning cloud resources

"Create a $100 AgentCard and set up a Vercel Pro plan for our team project."

Claude Code navigates the Vercel billing flow, enters the card details, and confirms the plan. You can check the remaining balance afterward and refund what wasn't used.

Security model

Look, the reality is that giving an AI agent a credit card sounds scary. We get it. That's exactly why we built AgentCard the way we did:

  • Hard spending limits — a $25 card maxes out at $25. Full stop. The agent can't override this.
  • One card per task — fresh card each time, no credential reuse across purchases.
  • Your real card stays hidden — Stripe handles the funding. The agent never sees your payment method.
  • Refundable — reclaim what wasn't spent with agentcard refund.

Worst case? You lose the card balance. Not your credit limit. We think that's the right tradeoff for autonomous agents.

Using the skill endpoint

Claude Code supports MCP, so it can discover tools automatically. Point it at our skill endpoint:

agentcard.ai/skill

It returns machine-readable instructions for every AgentCard command — actions, parameters, expected outputs. Claude Code reads it and knows what to do. Zero prompting from you.

Quick start

Copy and paste this block to get going:

# Install the CLI
npm install -g agentcard

# Sign up (click the magic link in your email)
agentcard signup --email you@example.com

# Create a $25 virtual card (opens Stripe Checkout)
agentcard create --amount 25

# Ask Claude Code to use it
# "Use AgentCard card <card-id> to buy [whatever you need]"

Cards work at any US-based merchant that accepts Visa. We launched in March 2026 and have processed thousands of agent purchases since then. Create a card, hand it to Claude Code, let it work.

Ready to try AgentCard?

Give your AI agent a virtual card in under 60 seconds.

npm install -g agentcard