Give value for a sale
POST /awards
The same reference again, at any age, answers the first result with replayed: true. A phone or email may name the card here: earning needs no card in hand. What one connection gives a card by count in a day is held to what its largest bill buys: one full card of stamps, or the points that bill would earn. A plan’s price times its quantity is held to the largest bill.
Scope: awards:write. The key’s connection must hold it; see the reference’s introduction.
Example
Section titled “Example”Replace the CAPITALS, and set PASSKAAR_KEY to a key from the portal.
curl -X POST "https://api.passkaar.com/integrations/v1/awards" \ -H "Authorization: Bearer $PASSKAAR_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "card": { "card_id": "CARD_ID" }, "reference": "ORDER-1001", "give": { "type": "stamps", "stamps": 1 }, "note": "Online order ORDER-1001"}'Parameters
Section titled “Parameters”| Name | In | Type | Required | What it is |
|---|---|---|---|---|
Idempotency-Key |
header | string | Any 1–255 visible ASCII characters, a UUID by preference. A retry with the same key within 24 hours answers the first result. reference is what guards a resend after that. |
Request body
Section titled “Request body”| Field | Type | Required | What it is |
|---|---|---|---|
card |
object | yes | Exactly one of serial, card_id, phone, email or external_id. A phone or email that matches several customers answers 409 ambiguous. Spending accepts only serial, card_id, or an external_id linked with the card. |
reference |
string | yes | The caller’s invoice, order or refund number, 1–64 visible ASCII characters. Unique per connection for ever within its kind (awards, redemptions, reversals, holds): the same reference again, at any age, answers the first result with replayed: true. |
bill |
object (Bill) | The sale. Required where the card earns from it; recorded on the card either way. | |
bill.total |
integer | yes | The whole bill in whole rupees, tax and delivery in it. |
bill.tax |
integer | Whole rupees of tax inside total. |
|
bill.delivery |
integer | Whole rupees of delivery inside total. |
|
bill.currency |
"PKR" |
yes | |
give |
object (GiveStamps) or object (GivePoints) or object (GiveTopUp) or object (GivePlan) or object (GiveCheckIn) or object (GiveVisit) | What is given. Omitted, the card earns from bill: a points card at its rate, a VIP card by its measure (a visit, or the whole rupees of the bill). Any other card then answers give_required. A coupon takes no award. |
|
paid_on_delivery |
boolean | True for an order paid on delivery (cash on delivery). Send it only once the order is delivered and paid. A shop that gives nothing on such orders answers operation_not_allowed. |
|
occurred_at |
string (date-time) | When the sale happened, for a late sale. Not in the future. Defaults to now. | |
branch |
string (uuid) | A branch’s id from GET /branches. Omitted, the connection’s branch if it has one, otherwise none. |
|
note |
string | Words for the row in the card’s history, at most 500 characters. |
Answers
Section titled “Answers”A replay of a reference already used.
| Field | Type | Required | What it is |
|---|---|---|---|
id |
string (uuid) | yes | |
reference |
string | yes | The caller’s invoice, order or refund number, 1–64 visible ASCII characters. Unique per connection for ever within its kind (awards, redemptions, reversals, holds): the same reference again, at any age, answers the first result with replayed: true. |
card |
object (CardIds) | yes | The card’s id and, where shown, its printed card ID. |
card.id |
string (uuid) | yes | |
card.card_id |
string or null | yes | The printed card ID, only when the call named the card by serial or card_id, the call made the card (a created sign-up), or this connection’s external_id was linked with the card. Null when the card was found by phone, email or an unproven link. |
type |
stamps, points, coupon, prepaid, membership, tiers |
yes | tiers is the VIP card; prepaid the prepaid card. |
earned |
object (Value) | yes | An amount in the card’s own units. Only the keys its type counts in are present; a check-in is {}. |
earned.stamps |
integer | ||
earned.rewards |
integer | Stamp-card rewards. | |
earned.points |
integer | ||
earned.rupees |
number | A prepaid card’s own rupees. | |
earned.bonus_rupees |
number | A prepaid top-up’s bonus, on top of rupees. |
|
earned.value_rupees |
number | What points spent on a cash-back points card are worth off the bill, for the caller’s discount line. | |
earned.sessions |
integer | ||
earned.deals |
integer | Coupon deals. | |
earned.qualifying |
integer | Towards a VIP card’s tier, in the card’s measure: visits, or whole rupees of spend. | |
earned.paid_through |
string (date) | A membership renewed to this day. | |
balance |
object | yes | The card’s standing after the call, by its type. |
rewards_unlocked |
array of object (UnlockedReward) | yes | Rewards this award made ready: a full stamp card, a catalogue reward. |
tier_reached |
object or null | yes | A VIP card that rose a tier with this award. |
tier_reached.key |
string | yes | |
tier_reached.name |
string | yes | |
occurred_at |
string (date-time) | yes | RFC 3339. Answers are in UTC; requests may carry any offset. |
recorded_at |
string (date-time) | yes | RFC 3339. Answers are in UTC; requests may carry any offset. |
replayed |
boolean | yes | True when this answers a reference or idempotency key already used. |
Given.
| Field | Type | Required | What it is |
|---|---|---|---|
id |
string (uuid) | yes | |
reference |
string | yes | The caller’s invoice, order or refund number, 1–64 visible ASCII characters. Unique per connection for ever within its kind (awards, redemptions, reversals, holds): the same reference again, at any age, answers the first result with replayed: true. |
card |
object (CardIds) | yes | The card’s id and, where shown, its printed card ID. |
card.id |
string (uuid) | yes | |
card.card_id |
string or null | yes | The printed card ID, only when the call named the card by serial or card_id, the call made the card (a created sign-up), or this connection’s external_id was linked with the card. Null when the card was found by phone, email or an unproven link. |
type |
stamps, points, coupon, prepaid, membership, tiers |
yes | tiers is the VIP card; prepaid the prepaid card. |
earned |
object (Value) | yes | An amount in the card’s own units. Only the keys its type counts in are present; a check-in is {}. |
earned.stamps |
integer | ||
earned.rewards |
integer | Stamp-card rewards. | |
earned.points |
integer | ||
earned.rupees |
number | A prepaid card’s own rupees. | |
earned.bonus_rupees |
number | A prepaid top-up’s bonus, on top of rupees. |
|
earned.value_rupees |
number | What points spent on a cash-back points card are worth off the bill, for the caller’s discount line. | |
earned.sessions |
integer | ||
earned.deals |
integer | Coupon deals. | |
earned.qualifying |
integer | Towards a VIP card’s tier, in the card’s measure: visits, or whole rupees of spend. | |
earned.paid_through |
string (date) | A membership renewed to this day. | |
balance |
object | yes | The card’s standing after the call, by its type. |
rewards_unlocked |
array of object (UnlockedReward) | yes | Rewards this award made ready: a full stamp card, a catalogue reward. |
tier_reached |
object or null | yes | A VIP card that rose a tier with this award. |
tier_reached.key |
string | yes | |
tier_reached.name |
string | yes | |
occurred_at |
string (date-time) | yes | RFC 3339. Answers are in UTC; requests may carry any offset. |
recorded_at |
string (date-time) | yes | RFC 3339. Answers are in UTC; requests may carry any offset. |
replayed |
boolean | yes | True when this answers a reference or idempotency key already used. |
Errors
Section titled “Errors”Every error is a Problem Details answer with a stable code.
| Status | Code |
|---|---|
| 400 | invalid_request |
| 401 | unauthorized |
| 404 | not_found |
| 409 | request_in_progress |
| 409 | ambiguous |
| 422 | idempotency_key_reused |
| 422 | reference_reused |
| 422 | card_not_active |
| 422 | operation_not_allowed |
| 422 | give_required |
| 422 | daily_cap_reached |
| 422 | bill_too_large |
| 422 | give_limit_reached |
| 422 | invalid_occurred_at |
| 429 | rate_limited |
| 500 | internal_error |
| 503 | unavailable |