Docs

Virtual cards

Quickstart

Have an active payer

A card is issued for a payer, and the payer must be active. Sign one up and record the verification decision, as in Payers:

Bash
curl -s -X POST https://sandbox.whire.ai/api/payers/$PAYER/activate \
  -H "X-API-Key: $KEY" -H "Content-Type: application/json" \
  -d '{ "verifiedBy": "Sam Visser" }'
Issue a card

Every create carries an Idempotency-Key, so a retry after a timeout returns the card you already asked for instead of issuing a second one. The answer is 202: the provider finishes the card a moment later.

Bash
curl -s -X POST https://sandbox.whire.ai/api/cards \
  -H "X-API-Key: $KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "payerId": "1618b583-4f9d-470d-842a-247d5b642835",
    "label": "Support agent 1",
    "limits": { "total": 250, "perTransaction": 80 },
    "metadata": { "customerRef": "cus_8841" }
  }'
JSON
{
  "ok": true,
  "data": {
    "cardId": "b2c11d1d-50ef-4efb-b6c9-ed668e19055c",
    "payerId": "1618b583-4f9d-470d-842a-247d5b642835",
    "label": "Support agent 1",
    "metadata": { "customerRef": "cus_8841" },
    "state": "provisioning",
    "failureReason": null,
    "currency": "EUR",
    "limits": { "perTransaction": 80, "total": 250 },
    "last4": null,
    "actions": { "update": false, "freeze": false, "unfreeze": false, "close": false, "reveal": false },
    "createdAt": "2026-10-27T22:48:29.418Z",
    "updatedAt": "2026-10-27T22:48:29.419Z"
  }
}
Wait until it is active

Read the card until state is active. The sandbox takes three seconds.

Bash
curl -s https://sandbox.whire.ai/api/cards/b2c11d1d-50ef-4efb-b6c9-ed668e19055c \
  -H "X-API-Key: $KEY" | jq -c '.data | {state, last4, actions}'
JSON
{"state":"active","last4":"9732","actions":{"update":true,"freeze":true,"unfreeze":false,"close":true,"reveal":true}}
List a customer's cards
Bash
curl -s "https://sandbox.whire.ai/api/cards?payerId=1618b583-4f9d-470d-842a-247d5b642835&pageSize=2" \
  -H "X-API-Key: $KEY" | jq -c '.data.pagination'
JSON
{"page":1,"pageSize":2,"pages":2,"total":4,"hasNext":true,"hasPrev":false}
Read the number

The number and security code are never in a card. You ask for them with a public key of your own, and they come back encrypted to it. Only your private key opens them.

import base64
import httpx
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import padding, rsa

private_key = rsa.generate_private_key(public_exponent=65537, key_size=2048)
public_pem = private_key.public_key().public_bytes(
    serialization.Encoding.PEM, serialization.PublicFormat.SubjectPublicKeyInfo
).decode()

response = httpx.post(
    f"https://sandbox.whire.ai/api/cards/{card_id}/reveal",
    headers={"X-API-Key": KEY},
    json={"publicKey": public_pem},
)
details = response.json()["data"]

oaep = padding.OAEP(mgf=padding.MGF1(hashes.SHA256()), algorithm=hashes.SHA256(), label=None)
pan = private_key.decrypt(base64.b64decode(details["pan"]), oaep).decode()
cvv2 = private_key.decrypt(base64.b64decode(details["cvv2"]), oaep).decode()
print(pan, cvv2, details["expiryMonth"], details["expiryYear"], details["cardholderName"])

Do this in your own code, not in a conversation with a model: the decrypted number should reach the page that pays and nowhere else.

Close it
Bash
curl -s -X DELETE https://sandbox.whire.ai/api/cards/b2c11d1d-50ef-4efb-b6c9-ed668e19055c \
  -H "X-API-Key: $KEY" | jq -c '.data | {state, actions}'
JSON
{"state":"closing","actions":{"update":false,"freeze":false,"unfreeze":false,"close":false,"reveal":false}}

A moment later the state is closed. The card stays in your list.