Cards
Issuing a card returns its serial and the Apple, Google and web URLs.
Endpoints
POST
/cardsIssue a card and return the Apple, Google and web URLs.
GET
/cards/{serial}Balance, tier, status and program of one card.
POST
/cards/{serial}/topupPrepaid: sell packs. Body packs (default 1) and amount (default packs × pack_price). Adds packs × units_per_pack.
POST
/cards/{serial}/usePrepaid: deduct count units, 1 up to max_use_per_scan. Refused with insufficient_units when fewer remain.
POST
/cards/{serial}/blockBlock or unblock a card without deleting its ledger.
Example
curl -X POST https://perfito.al/v1/cards \ -H "Authorization: Bearer sk_test_…" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: 0fa416e7" \ -d '{ "program_id": 4, "customer": { "phone": "+355691234567" } }'
$ch = curl_init('https://perfito.al/v1/cards'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => '{ "program_id": 4, "customer": { "phone": "+355691234567" } }', CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $key, 'Content-Type: application/json'], ]); $data = json_decode(curl_exec($ch), true);
const res = await fetch('https://perfito.al/v1/cards', { method: 'POST', headers: { Authorization: `Bearer ${key}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ "program_id": 4, "customer": { "phone": "+355691234567" } }), }); const data = await res.json();
curl -X POST https://perfito.al/v1/cards/PF-8F2A-19/topup \ -H "Authorization: Bearer sk_test_…" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: till-2291" \ -d '{ "packs": 1, "amount": 800, "reference": "till-2291" }'
curl -X POST https://perfito.al/v1/cards/PF-8F2A-19/use \ -H "Authorization: Bearer sk_test_…" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: till-2292" \ -d '{ "count": 2, "reference": "till-2292" }'