Kartat
Lëshimi i një karte kthen serialin dhe URL-të për Apple, Google dhe web.
Pikat fundore
POST
/cardsLësho një kartë dhe kthe URL-të për Apple, Google dhe web.
GET
/cards/{serial}Bilanci, niveli, statusi dhe programi i një karte.
POST
/cards/{serial}/topupParapagim: shit paketa. Fushat packs (parazgjedhur 1) dhe amount (parazgjedhur packs × pack_price). Shton packs × units_per_pack.
POST
/cards/{serial}/useParapagim: zbrit count njësi, nga 1 deri në max_use_per_scan. Refuzohet me insufficient_units kur mbeten më pak.
POST
/cards/{serial}/blockBlloko ose zhblloko një kartë pa fshirë regjistrin e saj.
Shembull
curl -X POST https://perfito.al/v1/cards \ -H "Authorization: Bearer sk_test_…" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: 380aae1b" \ -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" }'