Sign a customer up
POST /enrolments
Only on the customer’s own tap, never in bulk. Makes the customer and the card in one step and answers a claim link for the customer to add the card to their wallet. Earning starts at once. already_member answers a link only for a card this connection made.
Scope: customers:enrol. 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/enrolments" \ -H "Authorization: Bearer $PASSKAAR_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "program": "PROGRAM_ID", "answers": { "first_name": "Ayesha", "phone": "03001234567" }}'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 |
|---|---|---|---|
program |
string (uuid) | yes | The card to sign up for, from GET /programs. |
answers |
object | yes | The join form’s answers by form[].key from GET /programs/{id}: the first name and the dedupe key at least. Dates are YYYY-MM-DD. A required field left out is asked on the claim page. |
external_id |
string | The integration’s own id for the customer, 1–128 visible ASCII characters. Unique per connection in both directions. | |
branch |
string (uuid) | Where the customer signed up. | |
opening_balance |
object | A starting balance for a customer moving from another system. Needs customers:opening-balance, which Passkaar switches on per connection. |
|
opening_balance.amount |
integer | yes | In the card’s own unit: stamps, points or whole rupees. Which card types take one is not settled (ADR 0214). |
opening_balance.reason |
string | yes | Why, as the ledger row will read: “Moved from our old card”. |
Answers
Section titled “Answers”already_member: the customer already holds this card.
| Field | Type | Required | What it is |
|---|---|---|---|
result |
created, already_member |
yes | already_member: the customer already holds this card. Nothing new is made; external_id is linked to them, and the answer is 200 rather than 201. That link was made from a phone or email alone: it earns, it does not spend, and card.card_id is null. |
customer |
object (CustomerIds) | yes | This connection’s external_id, if it set one. |
customer.id |
string (uuid) | yes | |
customer.external_id |
string or null | yes | |
card |
object | yes | |
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. |
card.in_wallet |
boolean | yes | |
card.claimable |
boolean | yes | True while this connection made the card and it has never been in a wallet. A lost card is re-handed only at the till. |
claim |
object (ClaimLink) or null | yes | Null on already_member for a card this connection did not make: a phone or email alone never hands out a card, and such a card goes onto a phone only at the till. |
claim.url |
string (uri) | yes | Open on the customer’s phone; on a desktop it shows a QR to continue there. Dead once the card is in a wallet. |
claim.expires_at |
string (date-time) | yes | Seven days from when it was made. |
The customer and the card were made.
| Field | Type | Required | What it is |
|---|---|---|---|
result |
created, already_member |
yes | already_member: the customer already holds this card. Nothing new is made; external_id is linked to them, and the answer is 200 rather than 201. That link was made from a phone or email alone: it earns, it does not spend, and card.card_id is null. |
customer |
object (CustomerIds) | yes | This connection’s external_id, if it set one. |
customer.id |
string (uuid) | yes | |
customer.external_id |
string or null | yes | |
card |
object | yes | |
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. |
card.in_wallet |
boolean | yes | |
card.claimable |
boolean | yes | True while this connection made the card and it has never been in a wallet. A lost card is re-handed only at the till. |
claim |
object (ClaimLink) or null | yes | Null on already_member for a card this connection did not make: a phone or email alone never hands out a card, and such a card goes onto a phone only at the till. |
claim.url |
string (uri) | yes | Open on the customer’s phone; on a desktop it shows a QR to continue there. Dead once the card is in a wallet. |
claim.expires_at |
string (date-time) | yes | Seven days from when it was made. |
Errors
Section titled “Errors”Every error is a Problem Details answer with a stable code.
| Status | Code |
|---|---|
| 400 | invalid_request |
| 401 | unauthorized |
| 403 | shop_locked |
| 404 | not_found |
| 409 | request_in_progress |
| 409 | external_id_taken |
| 422 | idempotency_key_reused |
| 422 | program_closed |
| 422 | customer_limit_reached |
| 422 | invalid_answers |
| 422 | opening_balance_not_allowed |
| 422 | operation_not_allowed |
| 429 | rate_limited |
| 500 | internal_error |
| 503 | unavailable |