POS API
A point-of-sale system checks the customer's card and performs operations on it like staff in the Cardevo app: stamps, points for a receipt, gift card payments, coupons, membership entries and undo. No personal data.
Swagger UI – try requests with your own token (you paste the token yourself; it is not stored)
Quick start #
- The company owner creates a token in the dashboard: Ustawienia → API kasy → Nowy token (Settings → POS API → New token, Business plan and higher). The full token
cdv_pos_…is shown only once. - The till reads the code from the customer's card QR (or the link
https://app.cardevo.pl/c/CODE) and asks for the card state. - It performs an operation with an
Idempotency-Keyheader (e.g. the receipt number).
export CARDEVO_TOKEN="cdv_pos_…"
curl -s https://app.cardevo.pl/api/v1/pos/cards/K7Q2M9XA -H "Authorization: Bearer $CARDEVO_TOKEN"The response has a type field (stamps, points, gift_balance, coupon, membership) and the state of that card type. isTest: true marks the owner's test card: operations work but do not count in statistics.
Token and scopes #
Header Authorization: Bearer cdv_pos_…. The token works only on /api/v1/pos/…; it does not open the dashboard or customer data. The owner picks scopes when creating it: cards.read, stamps, points, gift, membership, coupon, undo. An operation needs both the token scope and the plan feature. A revoked token immediately gets 401. Card design over the API and the embedded editor (design:read, design:write, design:approve, embed; they require accepting the API terms and are enabled by Cardevo): embedding documentation.
Token security #
- Allowed addresses. The owner can restrict a token to IP addresses or CIDR networks (e.g. the shop's fixed IP). Requests from elsewhere get
403 ip_not_allowed; the message shows the address Cardevo sees. An empty list means no restriction. - Daily gift card payment limit. The sum of gift card balance payments (
gift/charge) made with one token since midnight (Polish time) is limited: 10,000 PLN by default, adjustable by the owner in the dashboard (1 – 100,000 PLN). Above it:403 gift_daily_limitand an e-mail to the owner (once a day). Undone payments do not count; a retry with the sameIdempotency-Keyon the same card returns the stored result (the same key on another card is a new payment within the limit).
Idempotency-Key (required on every POST) #
- 8–80 characters: letters, digits and
- _ . :; ideally the receipt number with a till prefix, or a UUID. - A retry with the same key (timeout, dropped connection) does not repeat the operation: the result is the same, with the header
Idempotent-Replayed: true. - The same key with a different body (e.g. another amount):
422 idempotency_mismatch. Keys are separate for each token. - Not sure whether an operation went through:
GET …/operations/by-key/{key}(404 = not yet).
Limits and plan changes #
Per token: 300 reads and 120 operations per minute. Above that: 429 with Retry-After (seconds). After a downgrade below Business, tokens keep working for 30 days (every response has the X-Cardevo-Plan-Warning header), then 403 plan_required; after an upgrade they work again immediately.
Errors #
Format application/problem+json: code (stable, handle it in the integration) and title (in Polish, for the cashier).
| Status | code | Meaning |
|---|---|---|
| 400 | idempotency_key_required, invalid_idempotency_key, invalid_amount | missing or invalid key, invalid amount |
| 401 | – | missing, unknown or revoked token |
| 403 | scope_missing | the token lacks the required scope |
| 403 | plan_required | the plan has no POS API or no such card type (after the grace period) |
| 403 | ip_not_allowed | request from outside the token's allowed addresses (the message shows the address Cardevo sees) |
| 403 | gift_daily_limit | the token's daily gift card payment limit is used up (until midnight, Polish time) |
| 404 | not_found | no such card in this company |
| 409 | wrong_card_type, card_blocked, insufficient_balance, nothing_to_undo, program_not_active, … | the operation is not possible in the current card state |
| 422 | idempotency_mismatch | same key with a different body |
| 429 | – | rate limit per token; retry after Retry-After |
Stamp card: add a stamp, redeem the reward #
The till adds one stamp per purchase. When the card is complete (rewardAvailable), it redeems the reward.
Add a stamp
curl -s -X POST https://app.cardevo.pl/api/v1/pos/cards/S7AMP001/stamps \
-H "Authorization: Bearer $CARDEVO_TOKEN" -H "Idempotency-Key: till1-receipt-000125" -H "Content-Type: application/json" \
-d '{}'{ "operationId": "019a…", "type": "StampAdded", "stampsAfter": 7, "stampGoal": 10, "rewardAvailable": false, "replayed": false }Redeem the reward
curl -s -X POST https://app.cardevo.pl/api/v1/pos/cards/S7AMP001/rewards/redeem \
-H "Authorization: Bearer $CARDEVO_TOKEN" -H "Idempotency-Key: till1-receipt-000126" -H "Content-Type: application/json" \
-d '{}'Points card: points for a receipt, redeem the reward #
Send the receipt amount in grosze (PLN 25.50 = 2550). Cardevo calculates the points from the card rules (the rate field in the card state).
Points for a PLN 25.50 receipt
curl -s -X POST https://app.cardevo.pl/api/v1/pos/cards/K7Q2M9XA/points/earn \
-H "Authorization: Bearer $CARDEVO_TOKEN" -H "Idempotency-Key: till1-receipt-000123" -H "Content-Type: application/json" \
-d '{"amountGrosze": 2550}'{ "operationId": "019a…", "type": "PointsEarned", "points": 25, "balanceBefore": 95, "balanceAfter": 120, "amountGrosze": 2550, "replayed": false }Redeem the points reward
curl -s -X POST https://app.cardevo.pl/api/v1/pos/cards/K7Q2M9XA/points/redeem \
-H "Authorization: Bearer $CARDEVO_TOKEN" -H "Idempotency-Key: till1-receipt-000127" -H "Content-Type: application/json" \
-d '{}'Gift card: pay with the balance, top up #
A payment charges the gift card balance. With insufficient funds the API returns 409 insufficient_balance (the balance is in the message); with allowPartial it takes the whole balance and the customer pays the rest.
Pay PLN 40.00
curl -s -X POST https://app.cardevo.pl/api/v1/pos/cards/B0N4X2PQ/gift/charge \
-H "Authorization: Bearer $CARDEVO_TOKEN" -H "Idempotency-Key: till1-receipt-000124" -H "Content-Type: application/json" \
-d '{"amountGrosze": 4000, "allowPartial": false}'{ "operationId": "019a…", "type": "GiftCharged", "amountGrosze": 4000, "balanceBefore": 10000, "balanceAfter": 6000, "replayed": false }Partial payment (whole balance)
curl -s -X POST https://app.cardevo.pl/api/v1/pos/cards/B0N4X2PQ/gift/charge \
-H "Authorization: Bearer $CARDEVO_TOKEN" -H "Idempotency-Key: till1-receipt-000128" -H "Content-Type: application/json" \
-d '{"amountGrosze": 8240, "allowPartial": true}'Top up PLN 50.00
curl -s -X POST https://app.cardevo.pl/api/v1/pos/cards/B0N4X2PQ/gift/topup \
-H "Authorization: Bearer $CARDEVO_TOKEN" -H "Idempotency-Key: till1-receipt-000129" -H "Content-Type: application/json" \
-d '{"amountGrosze": 5000}'Top-ups work when the card rules allow them (canTopUp in the card state), in the amounts from the rules (denominations or a range).
Coupon: redeem #
One use of the coupon. A used or expired coupon returns 409 with the reason.
Redeem
curl -s -X POST https://app.cardevo.pl/api/v1/pos/cards/KUP0N001/coupon/redeem \
-H "Authorization: Bearer $CARDEVO_TOKEN" -H "Idempotency-Key: till1-receipt-000130" -H "Content-Type: application/json" \
-d '{}'Membership pass: record an entry #
Records one entry on a valid membership pass. A used up, expired or not yet activated pass returns 409.
Entry
curl -s -X POST https://app.cardevo.pl/api/v1/pos/cards/KARNET01/membership/entries \
-H "Authorization: Bearer $CARDEVO_TOKEN" -H "Idempotency-Key: gate1-000131" -H "Content-Type: application/json" \
-d '{}'{ "operationId": "019a…", "type": "EntryUsed", "membership": { "state": "active", "entriesLeft": 6, "entriesTotal": 10, "entriesUsed": 4 }, "replayed": false }Undo (void) and retry after a timeout #
A token can only undo its own operations and only within the undo window, like staff in the app. Without operationId the API undoes the most recent operation this token can undo (the undo field in the card state).
Void a receipt
curl -s -X POST https://app.cardevo.pl/api/v1/pos/cards/K7Q2M9XA/undo \
-H "Authorization: Bearer $CARDEVO_TOKEN" -H "Idempotency-Key: till1-receipt-000123-void" -H "Content-Type: application/json" \
-d '{"operationId": "019a…"}'Did the operation go through? (after a timeout)
curl -s https://app.cardevo.pl/api/v1/pos/cards/K7Q2M9XA/operations/by-key/till1-receipt-000123 \
-H "Authorization: Bearer $CARDEVO_TOKEN"A 404 from the lookup by key means the operation has not happened yet: send the same POST with the same Idempotency-Key. The response will be the same as the first time (header Idempotent-Replayed: true).
SDK and examples #
TypeScript / JavaScript – package @cardevo/pos-sdk (in the Cardevo repository, npm release coming): types from OpenAPI, automatic Idempotency-Key and retries after 429 with the same key.
import { CardevoPos, CardevoPosError } from "@cardevo/pos-sdk";
const pos = new CardevoPos({ token: process.env.CARDEVO_TOKEN! });
const card = await pos.getCard("K7Q2M9XA");
try {
// Receipt number as the key: a retry after a timeout will not add points twice.
const r = await pos.earnPoints("K7Q2M9XA", 2550, { idempotencyKey: "till1-receipt-000123" });
console.log(`+${r.points} pts, balance ${r.balanceAfter}`);
} catch (e) {
if (e instanceof CardevoPosError) console.error(e.code, e.title); // e.g. insufficient_balance
}PHP
<?php
$ch = curl_init("https://app.cardevo.pl/api/v1/pos/cards/K7Q2M9XA/points/earn");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("CARDEVO_TOKEN"),
"Idempotency-Key: till1-receipt-000123", // same key on retry
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(["amountGrosze" => 2550]),
]);
$body = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status !== 200) {
// handle $body["code"]; show $body["title"] to the cashier
}C#
using System.Net.Http.Json;
var http = new HttpClient { BaseAddress = new Uri("https://app.cardevo.pl") };
http.DefaultRequestHeaders.Authorization = new("Bearer", Environment.GetEnvironmentVariable("CARDEVO_TOKEN"));
var request = new HttpRequestMessage(HttpMethod.Post, "/api/v1/pos/cards/K7Q2M9XA/points/earn")
{
Content = JsonContent.Create(new { amountGrosze = 2550 }),
};
request.Headers.Add("Idempotency-Key", "till1-receipt-000123"); // same key on retry
var response = await http.SendAsync(request);
var json = await response.Content.ReadFromJsonAsync<System.Text.Json.JsonElement>();Reference #
OpenAPI 3.1 specification: https://app.cardevo.pl/api/openapi/pos.json · Swagger UI
GET /api/v1/pos/cards/{code}
Get card – Card state by the code from the customer's QR, or by the 13-digit card number from the card barcode (29…, EAN-13 check digit) (no personal data): card type, stamps, points, gift balance, membership, coupon, the operation that can be undone and recent operations. Scope cards.read. (getCard)
Response: PosCardDto
cardCode | string |
type | string |
programId | string (uuid) |
programName | string |
status | CardStatus |
isTest | boolean |
stamps | null | PosStampsDto |
points | null | PosPointsDto |
gift | null | PosGiftDto |
membership | null | MembershipView |
coupon | null | PosCouponDto |
undo | null | StaffUndoTarget |
recentOperations | array |
GET /api/v1/pos/cards/{code}/operations/by-key/{key}
Get operation by key – Whether an operation with this Idempotency-Key has already been performed (after a timeout). 404 = not yet; retry the POST with the same key. Scope cards.read. (getOperationByKey)
Response: OperationStatusDto
operationId | string (uuid) |
type | string |
stampsAfter | integer (int32) |
createdAt | string (date-time) |
amountGrosze ? | null | integer (int64) |
balanceGrosze ? | null | integer (int64) |
points ? | null | integer (int64) |
pointsBalance ? | null | integer (int64) |
POST /api/v1/pos/cards/{code}/stamps
Add a stamp – Adds one stamp to a stamp card (same rules and limits as the staff app). Scope stamps. (addStamp)
Response: OperationResultDto
operationId | string (uuid) |
type | string |
stampsAfter | integer (int32) |
stampGoal | integer (int32) |
rewardAvailable | boolean |
rewardsRedeemed | integer (int32) |
replayed | boolean |
membership ? | null | MembershipView |
POST /api/v1/pos/cards/{code}/rewards/redeem
Redeem stamp reward – Redeems the reward when the card has all stamps. Scope stamps. (redeemReward)
Response: OperationResultDto
operationId | string (uuid) |
type | string |
stampsAfter | integer (int32) |
stampGoal | integer (int32) |
rewardAvailable | boolean |
rewardsRedeemed | integer (int32) |
replayed | boolean |
membership ? | null | MembershipView |
POST /api/v1/pos/cards/{code}/points/earn
Earn points for a purchase – Points from the receipt amount in grosze, according to the card rules. Scope points. (earnPoints)
Request body: PointsEarnRequest
amountGrosze | integer (int64) |
locationId ? | null | string (uuid) |
Response: PointsResultDto
operationId | string (uuid) |
type | string |
points | integer (int64) |
balanceBefore | integer (int64) |
balanceAfter | integer (int64) |
amountGrosze | null | integer (int64) |
createdAt | string (date-time) |
replayed | boolean |
POST /api/v1/pos/cards/{code}/points/redeem
Redeem points reward – Deducts the reward threshold from the points balance. Scope points. (redeemPoints)
Response: PointsResultDto
operationId | string (uuid) |
type | string |
points | integer (int64) |
balanceBefore | integer (int64) |
balanceAfter | integer (int64) |
amountGrosze | null | integer (int64) |
createdAt | string (date-time) |
replayed | boolean |
POST /api/v1/pos/cards/{code}/gift/topup
Top up gift card – Tops up the gift card balance (amount allowed by the card rules). Scope gift. (topUpGift)
Request body: GiftAmountRequest
amountGrosze | integer (int64) |
allowPartial ? | boolean |
Response: GiftResultDto
operationId | string (uuid) |
type | string |
amountGrosze | integer (int64) |
balanceBefore | integer (int64) |
balanceAfter | integer (int64) |
validUntil | null | string (date) |
createdAt | string (date-time) |
replayed | boolean |
POST /api/v1/pos/cards/{code}/gift/charge
Pay with gift card balance – Charges the balance. Insufficient funds: 409 insufficient_balance; with allowPartial=true the whole balance is taken (amountGrosze in the result is lower than requested). Scope gift. (chargeGift)
Request body: GiftAmountRequest
amountGrosze | integer (int64) |
allowPartial ? | boolean |
Response: GiftResultDto
operationId | string (uuid) |
type | string |
amountGrosze | integer (int64) |
balanceBefore | integer (int64) |
balanceAfter | integer (int64) |
validUntil | null | string (date) |
createdAt | string (date-time) |
replayed | boolean |
POST /api/v1/pos/cards/{code}/coupon/redeem
Redeem coupon – One use of the coupon. Scope coupon. (redeemCoupon)
Response: OperationResultDto
operationId | string (uuid) |
type | string |
stampsAfter | integer (int32) |
stampGoal | integer (int32) |
rewardAvailable | boolean |
rewardsRedeemed | integer (int32) |
replayed | boolean |
membership ? | null | MembershipView |
POST /api/v1/pos/cards/{code}/membership/entries
Use membership entry – Records one entry on a valid membership pass. Scope membership. (useMembershipEntry)
Response: OperationResultDto
operationId | string (uuid) |
type | string |
stampsAfter | integer (int32) |
stampGoal | integer (int32) |
rewardAvailable | boolean |
rewardsRedeemed | integer (int32) |
replayed | boolean |
membership ? | null | MembershipView |
POST /api/v1/pos/cards/{code}/undo
Undo operation – Undoes an operation performed with this token within the undo window (e.g. a voided receipt). Without operationId: the most recent operation this token can undo (the undo field in the card state). The result has the shape of the card type's operation. Scope undo. (undo)
Response: OperationResultDto
operationId | string (uuid) |
type | string |
stampsAfter | integer (int32) |
stampGoal | integer (int32) |
rewardAvailable | boolean |
rewardsRedeemed | integer (int32) |
replayed | boolean |
membership ? | null | MembershipView |
Response: PointsResultDto
operationId | string (uuid) |
type | string |
points | integer (int64) |
balanceBefore | integer (int64) |
balanceAfter | integer (int64) |
amountGrosze | null | integer (int64) |
createdAt | string (date-time) |
replayed | boolean |
Response: GiftResultDto
operationId | string (uuid) |
type | string |
amountGrosze | integer (int64) |
balanceBefore | integer (int64) |
balanceAfter | integer (int64) |
validUntil | null | string (date) |
createdAt | string (date-time) |
replayed | boolean |