Overview
The OwnRewards API is a secure connection that lets an online store, app or billing system run the merchant’s loyalty programme at checkout — so shoppers earn and spend points everywhere, not only at the counter.
Recognise members
Find a shopper by mobile number or email, or enrol them in the loyalty programme in one step.
Show points and tier
Display the member’s points balance, tier and available coupons and rewards right in your checkout.
Show "you'll earn" points
Tell the shopper how many points this order will earn — a proven nudge to complete the purchase.
Apply points, coupons and rewards
Turn points, coupon codes or rewards into a discount, following the merchant’s own rules.
Record the sale safely
After payment, record the order so points are earned and spent in one step — never twice.
Handle returns
If an order is cancelled or returned, points are reversed automatically.
Who uses it
An e-commerce website
You can…Add "use your points" and "you’ll earn N points" to your cart and checkout.A mobile app
You can…Show the member’s card, balance and rewards inside your app.Billing or ordering software
You can…Record each sale against the member and apply their rewards as a discount.A marketing or CRM tool
You can…Issue coupons to members and get notified about sign-ups, sales, birthdays and win-backs.
| If you are… | You can… |
|---|---|
| An e-commerce website | Add "use your points" and "you’ll earn N points" to your cart and checkout. |
| A mobile app | Show the member’s card, balance and rewards inside your app. |
| Billing or ordering software | Record each sale against the member and apply their rewards as a discount. |
| A marketing or CRM tool | Issue coupons to members and get notified about sign-ups, sales, birthdays and win-backs. |
Getting started
- 1
Create a key
The merchant opens Connect → API & Webhooks, picks the outlet and the "Storefront" permission preset.
- 2
Share it securely
The merchant gives the key and secret to the integration partner directly — never by public chat.
- 3
Connect and test
The partner’s developer follows the technical section of this guide. We provide a test account on request.
Set up your shell
Every example in this reference is a ready-to-run cURL command. Export your credentials once; set CUSTOMER_REF to the customerRef returned by Find or enrol a member.
export OWNREWARDS_API_KEY="ownrewards_<key>"
export OWNREWARDS_API_SECRET="<secret>"
export CUSTOMER_REF="<customerRef>" # from /identifySecurity
The merchant controls who connects, what each connection may do, and can close it at any time.
The merchant creates the key
Keys are made in the OwnRewards admin panel (Connect → API & Webhooks). iEYAL Solutions never sends keys by email or in documents.
A key and a secret, like a username and password
Both are required on every request. The secret is shown only once and is never stored in readable form.
Only the permissions you give
Each key is limited to chosen actions — for example "read members" and "record sales" — and nothing else.
Locked to one business and outlet
A key works only for the merchant that created it, and can be locked to a single outlet.
No double counting
Every recorded sale carries a unique reference, so a repeated request can never earn or spend points twice.
Revoke any time, signed updates
Revoke a key and it stops at once. Notifications we send you are digitally signed so you know they came from OwnRewards. All traffic is HTTPS and rate-limited.
Every feature requires a key. API keys are included in the Pro (up to 10 keys) and Enterprise (unlimited) plans. Webhooks are available from the Growth plan.
Checkout flow
A loyalty checkout, start to finish. Each step links to the endpoint that does it.
- 1. RecogniseFind or enrol the shopper by mobile number./identify
- 2. ShowPoints balance, tier and rewards./…/summary/…/rewards
- 3. ApplyUse points, a coupon or a reward; see the new total./cart/quote/coupons/validate
- 4. RecordAfter payment, record the sale — points earned and spent./cart/commit
- 5. ReturnCancelled? Points are reversed./order/return
OwnRewards applies the merchant’s own earning, tier, coupon and stacking rules, so online sales behave exactly like in-store sales.
Authentication
Send your key and secret as headers on every request. Keys are created by the merchant under Connect → API & Webhooks; the secret is shown only once.
Basics
Base address
Valuehttps://api.ownrewards.ai— all calls start with/v1/loyaltyFormat
ValueJSON over HTTPS, body up to 100 KBOutlet
ValueSend one ofrestId/eateryBranchCode(your branch code) oroutletId; if none, the key’s own outlet is usedLimits
Value120 requests per minute →429 rate_limitedwithRetry-After
| Item | Value |
|---|---|
| Base address | https://api.ownrewards.ai — all calls start with /v1/loyalty |
| Format | JSON over HTTPS, body up to 100 KB |
| Outlet | Send one of restId / eateryBranchCode (your branch code) or outletId; if none, the key’s own outlet is used |
| Limits | 120 requests per minute → 429 rate_limited with Retry-After |
Outlet
restIdstringoptionalOutlet id (send one of these three).
eateryBranchCodestringoptionalYour branch code.
outletIdstringoptionalOwnRewards outlet id. If none is sent, the key’s own outlet is used.
X-API-Key: ownrewards_<key>
X-API-Secret: <secret>
Content-Type: application/jsonResponses
Every response is JSON. status is success or failed. Successful calls return their result in data; failed calls include a readable message, a machine-readable code (see error codes) and optional details.
{
"status": "success",
"data": {}
}Rate limits
Each key can make 120 requests per minute. Above that the API returns 429 rate_limited with a Retry-After header — wait that long, then retry.
Request bodies can be up to 100 KB. All traffic is HTTPS.
HTTP/1.1 429 Too Many Requests
Retry-After: 30
{
"status": "failed",
"code": "rate_limited",
"message": "Slow down"
}Idempotency
Commit sale requires an Idempotency-Key header — one unique value per order. Retrying with the same key returns the first result ("replay": true) and never earns or spends points twice. Without the header the API returns 400 idempotency_key_required.
This makes commit safe to retry after a timeout or a 500 internal_error: send the same request with the same key.
curl -X POST "https://api.ownrewards.ai/v1/loyalty/cart/commit" \
-H "Idempotency-Key: order-100234" \
...
# Same key again → first result is returned, nothing is counted twice
{ "status": "success", "data": { ..., "replay": true } }Cart object
Used by earn preview, quote, coupon check and commit. In request bodies below it is shown as { …cart object… }; the cURL examples include it in full.
Fields
orderIdstringYour order id.
subtotalnumberAmount before tax.
totalnumberAmount including tax.
taxTotalnumberTotal tax.
items[]arrayLine items.
items[].itemIdstringYour SKU or item id.
items[].itemNamestringItem name.
items[].categorystringItem category, used for product multipliers.
items[].quantitynumberQuantity.
items[].pricePerUnitnumberUnit price.
items[].totalPricenumberquantity × pricePerUnit.
{
"orderId": "100234",
"subtotal": 1200,
"total": 1260,
"taxTotal": 60,
"items": [
{
"itemId": "SKU-1",
"itemName": "Mysore Pak",
"category": "Sweets",
"quantity": 2,
"pricePerUnit": 300,
"totalPrice": 600
}
]
}Applied object
What the shopper chose to use. All fields are optional.
Fields
pointsnumberoptionalPoints to redeem.
couponCodestringoptionalCoupon code to apply.
rewardIdstringoptionalA reward’s
_idfrom available rewards.
{
"points": 200,
"couponCode": "WELCOME10",
"rewardId": "<customerRewardId>"
}Members
Find or enrol a member
/v1/loyalty/identifyLooks up the shopper by mobile number, email or your own customer id. If they are not a member yet, they are enrolled automatically (this can be switched off).
customer:writeUse it for: sign-in, checkout, "join our rewards" buttons.Body parameters
phonestringMobile number of the shopper, e.g.
9876543210.countryCodestringCountry calling code, e.g.
91.namestringName used if the shopper is enrolled.
createIfMissingbooleanoptionalEnrol the shopper if not found. Set
falseto only look up.
curl -X POST "https://api.ownrewards.ai/v1/loyalty/identify" \
-H "X-API-Key: $OWNREWARDS_API_KEY" \
-H "X-API-Secret: $OWNREWARDS_API_SECRET" \
-H "Content-Type: application/json" \
-d '{
"phone": "9876543210",
"countryCode": "91",
"name": "Priya",
"createIfMissing": true
}'Show points balance and tier
/v1/loyalty/customers/{customerRef}/summaryReturns the member’s current points, points earned and spent so far, tier (e.g. Silver, Gold) and progress to the next tier.
customer:readUse it for: a loyalty card in your app, "you have 1,250 points" in checkout.Path parameters
customerRefstringrequiredThe member’s reference, returned by
/identify.
curl -X GET "https://api.ownrewards.ai/v1/loyalty/customers/$CUSTOMER_REF/summary" \
-H "X-API-Key: $OWNREWARDS_API_KEY" \
-H "X-API-Secret: $OWNREWARDS_API_SECRET"Show available coupons and rewards
/v1/loyalty/customers/{customerRef}/rewardsLists the coupons and rewards the member can use right now.
customer:readUse it for: a "your rewards" list the shopper can pick from at checkout.Path parameters
customerRefstringrequiredThe member’s reference, returned by
/identify.
Send a reward’s _id as applied.rewardId.
curl -X GET "https://api.ownrewards.ai/v1/loyalty/customers/$CUSTOMER_REF/rewards" \
-H "X-API-Key: $OWNREWARDS_API_KEY" \
-H "X-API-Secret: $OWNREWARDS_API_SECRET"Checkout
Show how many points an order will earn
/v1/loyalty/earn/previewCalculates the points this cart would earn, including tier bonuses and product multipliers. Nothing is saved.
customer:readUse it for: "Complete this order and earn 63 points".Body parameters
customerRefstringrequiredThe member’s reference, returned by
/identify.cartobjectrequiredThe order — see the cart object.
curl -X POST "https://api.ownrewards.ai/v1/loyalty/earn/preview" \
-H "X-API-Key: $OWNREWARDS_API_KEY" \
-H "X-API-Secret: $OWNREWARDS_API_SECRET" \
-H "Content-Type: application/json" \
-d '{
"customerRef": "<customerRef>",
"cart": {
"orderId": "100234",
"subtotal": 1200,
"total": 1260,
"taxTotal": 60,
"items": [
{
"itemId": "SKU-1",
"itemName": "Mysore Pak",
"category": "Sweets",
"quantity": 2,
"pricePerUnit": 300,
"totalPrice": 600
}
]
}
}'Apply points, a coupon or a reward and get the new total
/v1/loyalty/cart/quoteWorks out the discount and the final amount to charge, following the merchant’s rules on which offers can be combined. Explains anything that couldn’t be applied. Nothing is spent yet.
customer:readUse it for: "Use 200 points — save ₹20" before payment.Body parameters
customerRefstringrequiredThe member’s reference, returned by
/identify.cartobjectrequiredThe order — see the cart object.
appliedobjectoptionalPoints, coupon or reward the shopper chose — see the applied object.
curl -X POST "https://api.ownrewards.ai/v1/loyalty/cart/quote" \
-H "X-API-Key: $OWNREWARDS_API_KEY" \
-H "X-API-Secret: $OWNREWARDS_API_SECRET" \
-H "Content-Type: application/json" \
-d '{
"customerRef": "<customerRef>",
"cart": {
"orderId": "100234",
"subtotal": 1200,
"total": 1260,
"taxTotal": 60,
"items": [
{
"itemId": "SKU-1",
"itemName": "Mysore Pak",
"category": "Sweets",
"quantity": 2,
"pricePerUnit": 300,
"totalPrice": 600
}
]
},
"applied": {
"points": 200
}
}'Record the sale (points earned and spent)
/v1/loyalty/cart/commitAfter the customer has paid, records the order: points are earned, and any points, coupon or reward used are redeemed — all in one safe step that can’t happen twice.
bill:writeUse it for: the moment payment succeeds.Headers
Idempotency-KeystringrequiredOne unique value per order, e.g.
order-100234. Retries with the same key return the first result.
Body parameters
customerRefstringrequiredThe member’s reference, returned by
/identify.externalOrderIdstringrequiredYour order id. Use the same id for returns.
cartobjectrequiredThe order — see the cart object.
appliedobjectoptionalPoints, coupon or reward the shopper chose — see the applied object.
Idempotency-Key is required — one unique value per order. Retrying with the same key returns the first result ("replay": true) and never double-counts. /v1/loyalty/cart/commit-by-phone takes customerPhoneNo + countryCode instead of customerRef for existing members.
curl -X POST "https://api.ownrewards.ai/v1/loyalty/cart/commit" \
-H "X-API-Key: $OWNREWARDS_API_KEY" \
-H "X-API-Secret: $OWNREWARDS_API_SECRET" \
-H "Idempotency-Key: order-100234" \
-H "Content-Type: application/json" \
-d '{
"customerRef": "<customerRef>",
"externalOrderId": "100234",
"cart": {
"orderId": "100234",
"subtotal": 1200,
"total": 1260,
"taxTotal": 60,
"items": [
{
"itemId": "SKU-1",
"itemName": "Mysore Pak",
"category": "Sweets",
"quantity": 2,
"pricePerUnit": 300,
"totalPrice": 600
}
]
},
"applied": {
"points": 200
}
}'Coupons and returns
Check a coupon code
/v1/loyalty/coupons/validateTells you whether a code is valid for this member and cart, and how much it takes off — or why it can’t be used.
coupon:readUse it for: the "Apply coupon" box.Body parameters
customerRefstringrequiredThe member’s reference, returned by
/identify.codestringrequiredThe coupon code the shopper entered.
cartobjectrequiredThe order — see the cart object.
curl -X POST "https://api.ownrewards.ai/v1/loyalty/coupons/validate" \
-H "X-API-Key: $OWNREWARDS_API_KEY" \
-H "X-API-Secret: $OWNREWARDS_API_SECRET" \
-H "Content-Type: application/json" \
-d '{
"customerRef": "<customerRef>",
"code": "WELCOME10",
"cart": {
"orderId": "100234",
"subtotal": 1200,
"total": 1260,
"taxTotal": 60,
"items": [
{
"itemId": "SKU-1",
"itemName": "Mysore Pak",
"category": "Sweets",
"quantity": 2,
"pricePerUnit": 300,
"totalPrice": 600
}
]
}
}'Give a coupon to a shopper
/v1/loyalty/coupons/issueIssues one of the merchant’s coupons to a shopper by mobile number or email, enrolling them if needed.
coupon:writeUse it for: welcome offers, survey thank-yous, campaign rewards.Body parameters
codestringrequiredThe merchant’s coupon to issue.
phonestringMobile number of the shopper (or email).
countryCodestringCountry calling code, e.g.
91.namestringName used if the shopper is enrolled.
curl -X POST "https://api.ownrewards.ai/v1/loyalty/coupons/issue" \
-H "X-API-Key: $OWNREWARDS_API_KEY" \
-H "X-API-Secret: $OWNREWARDS_API_SECRET" \
-H "Content-Type: application/json" \
-d '{
"code": "WELCOME10",
"phone": "9876543210",
"countryCode": "91",
"name": "Priya"
}'Reverse points for a cancelled or returned order
/v1/loyalty/order/returnTakes back points earned on the order and gives back points that were spent.
bill:writeUse it for: cancellations and returns in your order system.Body parameters
orderIdstringrequiredThe same order id used at commit.
mobilestringMobile number of the member.
purchase_datestringDate of the original order,
YYYY-MM-DD.reasonstringWhy the order was cancelled or returned.
Returns { "status": "success", "data": { …refund result… } }.
curl -X POST "https://api.ownrewards.ai/v1/loyalty/order/return" \
-H "X-API-Key: $OWNREWARDS_API_KEY" \
-H "X-API-Secret: $OWNREWARDS_API_SECRET" \
-H "Content-Type: application/json" \
-d '{
"orderId": "100234",
"mobile": "9876543210",
"purchase_date": "2026-11-18",
"reason": "Customer cancelled"
}'Webhooks
OwnRewards sends a signed POST to your https address when something happens. The merchant switches these on under Connect → API & Webhooks. Every notification is signed and is retried if your system is temporarily down. Reply 2xx within 15 seconds; failures are retried up to 8 times (2 minutes → 1 hour). Use eventId to ignore duplicates.
Use it for: CRM sync, personalised messages, marketing automation.
Events
Member joined / updated
Sent whenA shopper joins or their details changeSale recorded
Sent whenA bill or order is recordedSale reversed
Sent whenA bill is refunded or an order cancelledVisit milestones
Sent whenFirst visit, every Nth visit, milestone reachedLapsed and won back
Sent whenA member goes inactive, or returnsSpecial dates
Sent whenBirthdays and anniversaries (on the day and coming up)
| Notification | Sent when |
|---|---|
| Member joined / updated | A shopper joins or their details change |
| Sale recorded | A bill or order is recorded |
| Sale reversed | A bill is refunded or an order cancelled |
| Visit milestones | First visit, every Nth visit, milestone reached |
| Lapsed and won back | A member goes inactive, or returns |
| Special dates | Birthdays and anniversaries (on the day and coming up) |
Delivery
Method
ValuePOST to your https addressYour reply
ValueAny 2xx within 15 secondsRetries
ValueUp to 8 times, from 2 minutes to 1 hour apartDuplicates
ValueUseeventIdto ignore repeatsSignature
ValueX-OwnRewards-Signature: HMAC-SHA256 oftimestamp.rawBodyFreshness
ValueReject timestamps older than 5 minutes
| Rule | Value |
|---|---|
| Method | POST to your https address |
| Your reply | Any 2xx within 15 seconds |
| Retries | Up to 8 times, from 2 minutes to 1 hour apart |
| Duplicates | Use eventId to ignore repeats |
| Signature | X-OwnRewards-Signature: HMAC-SHA256 of timestamp.rawBody |
| Freshness | Reject timestamps older than 5 minutes |
Verify the signature
HMAC-SHA256 with your whsec_… secret over timestamp + "." + rawBody, compared with X-OwnRewards-Signature. Reject timestamps older than 5 minutes.
X-OwnRewards-Event: bill_created
X-OwnRewards-Timestamp: 1763460900000
X-OwnRewards-Signature: <hex HMAC-SHA256>Error codes
400
Codevalidation_errorMeaningMissing or wrong field (detailslists them)400
Codeidempotency_key_requiredMeaningCommit sent withoutIdempotency-Key400
Codeinsufficient_pointsMeaningNot enough points to redeem400
Codereward_unavailablecoupon_invaliddiscount_exceeds_billMeaningThe discount can’t be applied401
CodeunauthorizedMeaningKey or secret missing, wrong or revoked403
Codeforbiddenoutlet_scope_mismatchMeaningMissing permission, or key locked to another outlet404
Codecustomer_not_foundoutlet_not_foundcoupon_not_foundMeaningNot found409
Codeduplicate_ordercoupon_already_issuedMeaningAlready done429
Coderate_limitedMeaningSlow down — seeRetry-After500
Codeinternal_errorMeaningTemporary problem — retry (commit is safe to retry with the same key)
| HTTP | Code | Meaning |
|---|---|---|
| 400 | validation_error | Missing or wrong field (details lists them) |
| 400 | idempotency_key_required | Commit sent without Idempotency-Key |
| 400 | insufficient_points | Not enough points to redeem |
| 400 | reward_unavailablecoupon_invaliddiscount_exceeds_bill | The discount can’t be applied |
| 401 | unauthorized | Key or secret missing, wrong or revoked |
| 403 | forbiddenoutlet_scope_mismatch | Missing permission, or key locked to another outlet |
| 404 | customer_not_foundoutlet_not_foundcoupon_not_found | Not found |
| 409 | duplicate_ordercoupon_already_issued | Already done |
| 429 | rate_limited | Slow down — see Retry-After |
| 500 | internal_error | Temporary problem — retry (commit is safe to retry with the same key) |
Changelog
- v1.1 · 19 November 2026Current version of the Loyalty Integration API.Download PDF
Need a test account?
Ask your iEYAL Solutions account manager. Questions during integration are answered by our technical team.