Virtual cards
Quickstart
A card is issued for a payer, and the payer must be active. Sign one up and record the verification decision, as in Payers:
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" }'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.
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" }
}'{
"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"
}
}Read the card until state is active. The sandbox takes three seconds.
curl -s https://sandbox.whire.ai/api/cards/b2c11d1d-50ef-4efb-b6c9-ed668e19055c \
-H "X-API-Key: $KEY" | jq -c '.data | {state, last4, actions}'{"state":"active","last4":"9732","actions":{"update":true,"freeze":true,"unfreeze":false,"close":true,"reveal":true}}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'{"page":1,"pageSize":2,"pages":2,"total":4,"hasNext":true,"hasPrev":false}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"])import { constants, generateKeyPairSync, privateDecrypt } from "node:crypto";
const { publicKey, privateKey } = generateKeyPairSync("rsa", {
modulusLength: 2048,
publicKeyEncoding: { type: "spki", format: "pem" },
privateKeyEncoding: { type: "pkcs8", format: "pem" },
});
const response = await fetch(`https://sandbox.whire.ai/api/cards/${cardId}/reveal`, {
method: "POST",
headers: { "X-API-Key": KEY, "Content-Type": "application/json" },
body: JSON.stringify({ publicKey }),
});
const { data } = await response.json();
const open = (base64) =>
privateDecrypt(
{ key: privateKey, padding: constants.RSA_PKCS1_OAEP_PADDING, oaepHash: "sha256" },
Buffer.from(base64, "base64"),
).toString();
console.log(open(data.pan), open(data.cvv2), data.expiryMonth, data.expiryYear, data.cardholderName);openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out card-key.pem
openssl pkey -in card-key.pem -pubout -out card-key.pub.pem
curl -s -X POST https://sandbox.whire.ai/api/cards/$CARD/reveal \
-H "X-API-Key: $KEY" -H "Content-Type: application/json" \
-d "{\"publicKey\": $(jq -Rs . < card-key.pub.pem)}" > details.json
jq -r .data.pan details.json | base64 -d | openssl pkeyutl -decrypt -inkey card-key.pem \
-pkeyopt rsa_padding_mode:oaep -pkeyopt rsa_oaep_md:sha256Do this in your own code, not in a conversation with a model: the decrypted number should reach the page that pays and nowhere else.
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}'{"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.