Capital Quality Wallet API
Connect your POS, e-commerce or app: find or enroll customers, award and redeem points, issue Apple Wallet and Google Wallet passes, and receive signed webhooks.
Quickstart
- Sign in to the dashboard and switch to Sandbox (top right).
- Open Developers → API keys and create a key. Sandbox keys start with
lw_test_; the sandbox comes with a demo program, rewards and a published pass template. - Call
GET https://wallet.capitalquality.net/api/v1/mewithAuthorization: Bearer <key>to confirm access. - Record a sale with the POS flow below, then open the returned customer in the dashboard.
Authentication
Two options, both scoped (least privilege) and optionally restricted to IP ranges:
- API keys for servers and POS terminals:
Authorization: Bearer lw_live_… - OAuth 2.0 client credentials:
POST https://wallet.capitalquality.net/api/v1/oauth/tokenwithgrant_type=client_credentialsreturns a 1-hour bearer token. Rotating a client secret keeps the old one valid for 24 hours.
Never put keys in browser or mobile app code. Every response includes an X-Request-Id header — include it when contacting support.
Sandbox and live
Each business has a live environment and a sandbox twin with separate data and credentials. The credential decides the environment, so the base URL is the same: https://wallet.capitalquality.net/api/v1. Sandbox passes are signed for testing and events have livemode: false.
POS integration flow
Enroll each customer once with POST /enrollments: it creates the customer and loyalty account, issues the wallet pass and returns the install links to hand to them.
# Enroll a customer (creates the account and the Apple/Google wallet pass)
curl -X POST https://wallet.capitalquality.net/api/v1/enrollments \
-H "Authorization: Bearer $LW_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: enroll-+96550001234" \
-d '{ "customer": { "phone": "+96550001234", "first_name": "Sara" } }'
# Response (201): customer, account, pass and install_links
# install_links.landing_url - send this to the customer; it offers the right wallet per device
# install_links.apple_url / google_url / qr_code_url - direct links for a receipt, SMS or screen
# Enrolling the same customer again is safe and returns the same pass (created: false).From then on, one call does it all: POST /pos/sales finds the customer (or creates them), awards points with your program rules and active campaigns, writes an immutable ledger entry, queues the wallet-pass update and returns the new balance. Your POS receipt number is the external_id; the same receipt can never earn twice.
# Record a sale (retries must reuse the same Idempotency-Key)
curl -X POST https://wallet.capitalquality.net/api/v1/pos/sales \
-H "Authorization: Bearer $LW_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: sale-SAL-000123" \
-d '{
"customer": {
"lookup": { "phone": "+96550001234" },
"create_if_missing": true,
"profile": { "first_name": "Sara", "phone": "+96550001234" }
},
"sale": { "external_id": "SAL-000123", "amount": 4500, "currency": "KWD" }
}'
# Response (201): points_awarded, balance.points and pass_update.
# pass_update.status is "queued" when the customer has a wallet pass (created by POST /enrollments,
# which also returns the Apple/Google install links) and "no_pass" otherwise.
# A replay with the same key returns the original response with Idempotent-Replayed: trueA few seconds later the customer's Apple Wallet or Google Wallet pass shows the new balance, and your webhook endpoint receives loyalty.points_earned. Verify its signature before trusting it:
# Webhooks are verified in your server code, not with cURL.
# Header format: LW-Signature: t=1790000000,v1=<hex>[,v1=<hex during secret rotation>]
# expected = HEX( HMAC_SHA256( endpoint_secret, t + "." + raw_request_body ) )
# Accept if any v1 equals expected (constant-time) and |now - t| <= 300 seconds.Idempotency
Send Idempotency-Key on every POST that changes balances (required on /pos/sales). Retrying with the same key and body returns the original response with Idempotent-Replayed: true; the same key with a different body returns 422 idempotency_key_reused. Keys are kept for 24 hours.
Errors
Errors use one shape with a stable machine-readable code (list of codes):
{
"error": {
"type": "business_rule_error",
"code": "insufficient_balance",
"message": "The account does not have enough points or stamps.",
"request_id": "req_01…",
"doc_url": "https://wallet.capitalquality.net/docs/errors#insufficient_balance"
}
}Types: invalid_request_error (400/404), authentication_error (401), permission_error (403), conflict_error (409), business_rule_error (422), plan_error (402), rate_limit_error (429), api_error (5xx, safe to retry with the same idempotency key).
Rate limits and pagination
Limits are per credential per minute and depend on your plan; every response carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset. Lists return { data, has_more, next_cursor }; pass starting_after=next_cursor for the next page.
Apple and Google Wallet
Passes are official Apple Wallet .pkpass files and Google Wallet loyalty objects. Share the install_links.landing_url from the enrollment or pass response; it offers the right wallet per device.
Updates: Apple is notified through APNs and devices fetch the new pass; Google objects are patched through the Google Wallet API. Google limits notifying updates to 3 per pass per 24 hours; later updates are silent.
Install signals differ: Apple reports a device registration, Google reports a save via callback. See event provenance.
requests for Python).