# Pay with a virtual card

Give an agent its own virtual card and see how each authorization is decided by the same policy, without the card number ever reaching the agent.

<ShortProductTruth>**A card number was never a permission.** Each agent can have its own virtual card, but the agent never sees the number. Abazi uses the card for the agent, and every authorization the card network sends comes back to Abazi's policy.</ShortProductTruth>

## What you end up with [#what-you-end-up-with]

An agent that can buy from a card-only merchant. The merchant sees an ordinary card payment from a virtual card. The owner sees the authorization, its decision and a receipt, and any attempt to use the card outside Abazi is declined and reported.

## Before you start [#before-you-start]

The agent's mandate must allow the card rail and set a card hard cap. In the example mandate the card limits are <Limit name="cardHardCap" /> per authorization and <Limit name="cardAutoThreshold" /> before a person must approve. Card limits are in US dollars.

## Steps [#steps]

<Steps>
<Step>

### Issue a card for the agent [#issue-a-card-for-the-agent]

In the Console, open Cards and issue a card for the agent. Abazi issues a virtual card with Lithic, with a per-transaction spending limit. An agent has at most one open card; asking again returns the same card. Abazi stores only a token and the last four digits.

<Screenshot id="console-cards" />

</Step>
<Step>

### The agent asks to buy [#the-agent-asks-to-buy]

The agent calls `request_purchase` for a card service in the Catalog, exactly as it would for a stablecoin service. The policy runs with the card limits: above the card hard cap it is denied, above the card auto-approve limit it needs a person.

</Step>
<Step>

### Abazi pays at the checkout [#abazi-pays-at-the-checkout]

On ALLOW, the amount is reserved. The signer fetches the card number from the card processor at that moment and sends it, server to server, to the merchant's checkout. The number is never stored, never logged and never handed to the agent.

</Step>
<Step>

### The card network asks Abazi [#the-card-network-asks-abazi]

The merchant authorizes the card. The card processor sends the authorization to Abazi in a signed request and waits for an answer. Abazi approves only if it finds a matching purchase: same agent, same amount, already reserved, within the last ten minutes.

| What Abazi finds | Answer |
| --- | --- |
| A reserved purchase with the same amount | Approve |
| A purchase of the same amount that is still waiting for a person | Challenge: the authorization is declined for now and tried again after approval |
| A purchase with a different amount | Decline, <ReasonCode code="CARD_AMOUNT_MISMATCH" /> |
| No purchase at all | Decline, <ReasonCode code="CARD_NO_MATCHING_INTENT" />, plus a risk event and a notice to the owners |

</Step>
<Step>

### Clearing and the receipt [#clearing-and-the-receipt]

When the card processor clears the authorization, the payment is confirmed: the reservation commits, the ledger posts and a receipt is issued. A voided authorization fails the payment and releases the reservation.

</Step>
</Steps>

## Above the auto-approve limit [#above-the-auto-approve-limit]

A card purchase above <Limit name="cardAutoThreshold" /> runs the checkout once while it waits for approval. Abazi answers that authorization with a challenge, so the card processor declines it. After a person approves, the checkout runs again and the new authorization finds a reserved purchase and is approved.

## Refunds [#refunds]

A refund on a card payment is sent as a card return. It is booked like any refund: the budget is credited, the ledger posts and a refund receipt is issued. The payment counts as refunded once the full amount is returned.

## Failure cases [#failure-cases]

| Situation | Result |
| --- | --- |
| The mandate does not allow the card rail | Denied with <ReasonCode code="RAIL_NOT_ALLOWED" />. |
| The amount is above the card hard cap | Denied with <ReasonCode code="HARD_CAP_EXCEEDED" />. |
| Someone uses the card number outside Abazi | Declined with <ReasonCode code="CARD_NO_MATCHING_INTENT" />; the owners are told. |
| The owner pauses all payments | Every authorization is declined. |

## Next steps [#next-steps]

<Cards>
  <Card title="Cards" href="/docs/products/cards" description="Read what Abazi Cards covers, from issuing to clearing." />
  <Card title="Approve on a phone" href="/docs/guides/approve-on-a-phone" description="See the approval that turns a challenged card authorization into a payment." />
  <Card title="Rail adapters" href="/docs/architecture/rail-adapters" description="Compare the card rail with x402 USDC and direct USDT." />
</Cards>

