Two ways in, pick whichever fits: a Partner API for your own backend to earn and redeem server-to-server with no counter or staff session, or a website widget - one script tag and an iframe, no backend required at all.
Get a key, then earn or redeem in one call.
Get a key from your admin console, send it as a bearer token on /api/v1/partner/loyalty/*, and POST a phone number plus a bill amount to get back a transaction id and balance.
curl -X POST https://<your-shop-domain>/api/v1/partner/loyalty/earn \
-H "Authorization: Bearer clpx_sk_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-48213" \
-d '{
"phone": "9845000000",
"billAmountPaise": 150000,
"orderId": "order-48213"
}'One key per shop, sent as a bearer token.
Authorization: Bearer clpx_sk_...Keys are scoped to loyalty.earn and/or loyalty.redeem. Wrong scope returns 403, a missing or revoked key returns 401. Issue and revoke keys from the admin console.
Three calls, everything else (tiering, expiry, minimum-to-redeem) is handled for you using the shop's own settings.
/api/v1/partner/loyalty/earnloyalty.earnRecords a purchase and credits points to the customer's balance at your shop, creating the customer if this is their first visit.
| Field | Type | Notes |
|---|---|---|
| phone* | string | Customer’s phone number, any common format. |
| billAmountPaise* | integer | Bill amount in paise (₹1 = 100). Must be > 0. |
| orderId* | string | Your own order id, up to 64 characters. Required - also enforces you can only ever earn once per order, no matter how the request is retried. |
| name | string | Customer’s name, up to 80 characters - only used the first time this phone is seen. |
| Field | Type | Notes |
|---|---|---|
| transactionId | uuid | This platform’s id for the transaction - keep it for support queries. |
| pointsEarned | integer | Points credited by this one call. |
| balance | integer | Customer’s new total balance at your shop. |
{
"phone": "9845000000",
"billAmountPaise": 150000,
"orderId": "order-48213",
"name": "Ananya Rao"
}{
"transactionId": "b7e1c9de-...",
"pointsEarned": 150,
"balance": 890
}/api/v1/partner/loyalty/redeemloyalty.redeemRedeems points against a bill, returning the discounted amount to charge the customer. Omit points to redeem the maximum the shop's own rules allow.
| Field | Type | Notes |
|---|---|---|
| phone* | string | Customer’s phone number. |
| billAmountPaise* | integer | Bill amount in paise, before this redemption. Must be > 0. |
| points | integer | Points to redeem. Omit to redeem the maximum allowed. |
| orderId* | string | Your own order id, up to 64 characters. Required - the same order can only ever be redeemed once. |
| Field | Type | Notes |
|---|---|---|
| transactionId | uuid | |
| pointsRedeemed | integer | Points actually redeemed by this call. |
| valuePaise | integer | Rupee value of the points redeemed, in paise. |
| netPayablePaise | integer | billAmountPaise minus valuePaise - what to actually charge. |
| balance | integer | Customer’s new balance after this redemption. |
{
"phone": "9845000000",
"billAmountPaise": 200000,
"points": 500,
"orderId": "order-48214"
}{
"transactionId": "1a2b3c4d-...",
"pointsRedeemed": 500,
"valuePaise": 50000,
"netPayablePaise": 150000,
"balance": 390
}/api/v1/partner/loyalty/wallet?phone=9845000000no scope requiredLooks up a customer's current balance at your shop only - never across other shops on the platform, even ones sharing the same phone number.
| Field | Type | Notes |
|---|---|---|
| found | boolean | False if this phone has never earned at your shop. |
| balance | integer | Current points balance. 0 if not found. |
| balanceValuePaise | integer | Rupee value of that balance, in paise. |
{
"found": true,
"balance": 890,
"balanceValuePaise": 89000
}One script tag, no backend - for a website to offer a balance check or earn.
The widget is still being built. It will use a separate, public key type - restricted to balance and earn only, safe to paste into page HTML - so redeeming will still require the Partner API above. Docs land here once it ships.
Dashboard-only today - an owner action, not something your key can call - but it changes a balance your integration reads, so it's documented here in full.
/api/v1/transactions/:id/refundowner session, not a partner keyRefunds part or all of a past bill. Refunding a redeem transaction gives the spent points back; refunding an earn transaction takes the earned points away. Partial refunds on the same bill are cumulative and proportional, with no rounding drift, and a second request racing the same bill is rejected rather than corrupting the balance.
| Field | Type | Notes |
|---|---|---|
| amountPaise | integer | Amount to refund, in paise. Omit to refund whatever remains unrefunded on this bill. |
| reason | string | Optional free-text note, shown on the transaction later. |
| Field | Type | Notes |
|---|---|---|
| refundedAmountPaise | integer | Amount refunded by this one call. |
| pointsAdjusted | integer | Points moved by this call - negative for a redeem refund, positive for an earn refund. |
| totalRefundedAmountPaise | integer | Cumulative refunded amount on this bill across every call so far. |
| remainingRefundableAmountPaise | integer | 0 once the bill is fully refunded. |
| fullyRefunded | boolean | |
| balance | integer | Customer's new balance after this refund. |
{
"amountPaise": 100000,
"reason": "Item returned"
}{
"refundedAmountPaise": 100000,
"pointsAdjusted": -50,
"totalRefundedAmountPaise": 100000,
"remainingRefundableAmountPaise": 150000,
"fullyRefunded": false,
"balance": 75
}Why this is here even though your key can't call it
An owner can refund any bill from the dashboard, including one your key created - so a customer's balance can change without your system initiating it. Don't treat your own running total as authoritative; call the wallet lookup endpoint above when you need the current balance, not a locally tracked sum.
One envelope for every failure: { error: { code, message } }.
| HTTP | Code | Meaning |
|---|---|---|
| 400 | bad_request | Malformed request - a field is missing or the wrong shape. |
| 422 | validation_failed | Request parsed, but a field failed validation (e.g. bill amount ≤ 0). |
| 401 | unauthorized | Missing, unknown, or revoked API key. |
| 403 | forbidden | Key is valid but not scoped for this endpoint. |
| 404 | not_found | Referenced resource does not exist. |
| 409 | conflict | Same idempotency key reused with a different request body. |
| 429 | rate_limited | Too many requests - back off and retry. |
| 500 | internal_error | Our fault, not yours - safe to retry. |
{
"error": {
"code": "forbidden",
"message": "This key is not scoped for loyalty.redeem."
}
}Keys are issued per shop from the platform admin console. Already a Calypx shop? Ask whoever onboarded you to issue one from Admin → API keys.