OwnRewards

Developers / Loyalty Integration APIv1.1 · Published by iEYAL Solutions

Loyalty Integration API

Bring OwnRewards points and coupons into your checkout. Recognise members, show their points, apply rewards as discounts and record every sale — automatically and securely.

Download PDFv1.1 · PDF · 1 MB
Base URL
https://api.ownrewards.ai
Version
v1.1 · 19 November 2026
Auth
X-API-Key + X-API-Secret
Rate limit
120 req / min

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.

Getting started

  1. 1

    Create a key

    The merchant opens Connect → API & Webhooks, picks the outlet and the "Storefront" permission preset.

  2. 2

    Share it securely

    The merchant gives the key and secret to the integration partner directly — never by public chat.

  3. 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.

Shell
export OWNREWARDS_API_KEY="ownrewards_<key>"
export OWNREWARDS_API_SECRET="<secret>"
export CUSTOMER_REF="<customerRef>"   # from /identify

Security

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. 1. RecogniseFind or enrol the shopper by mobile number./identify
  2. 2. ShowPoints balance, tier and rewards./…/summary/…/rewards
  3. 3. ApplyUse points, a coupon or a reward; see the new total./cart/quote/coupons/validate
  4. 4. RecordAfter payment, record the sale — points earned and spent./cart/commit
  5. 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/loyalty
  • Format

    ValueJSON over HTTPS, body up to 100 KB
  • Outlet

    ValueSend one of restId / eateryBranchCode (your branch code) or outletId; if none, the key’s own outlet is used
  • Limits

    Value120 requests per minute → 429 rate_limited with Retry-After

Outlet

  • restIdstringoptional

    Outlet id (send one of these three).

  • eateryBranchCodestringoptional

    Your branch code.

  • outletIdstringoptional

    OwnRewards outlet id. If none is sent, the key’s own outlet is used.

Headers
X-API-Key: ownrewards_<key>
X-API-Secret: <secret>
Content-Type: application/json

Responses

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.

429 response
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.

Retry
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

  • orderIdstring

    Your order id.

  • subtotalnumber

    Amount before tax.

  • totalnumber

    Amount including tax.

  • taxTotalnumber

    Total tax.

  • items[]array

    Line items.

  • items[].itemIdstring

    Your SKU or item id.

  • items[].itemNamestring

    Item name.

  • items[].categorystring

    Item category, used for product multipliers.

  • items[].quantitynumber

    Quantity.

  • items[].pricePerUnitnumber

    Unit price.

  • items[].totalPricenumber

    quantity × pricePerUnit.

Cart object
{
  "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

  • pointsnumberoptional

    Points to redeem.

  • couponCodestringoptional

    Coupon code to apply.

  • rewardIdstringoptional

    A reward’s _id from available rewards.

Applied object
{
  "points": 200,
  "couponCode": "WELCOME10",
  "rewardId": "<customerRewardId>"
}

Members

Find or enrol a member

POST/v1/loyalty/identify

Looks 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).

Permission customer:writeUse it for: sign-in, checkout, "join our rewards" buttons.

Body parameters

  • phonestring

    Mobile number of the shopper, e.g. 9876543210.

  • countryCodestring

    Country calling code, e.g. 91.

  • namestring

    Name used if the shopper is enrolled.

  • createIfMissingbooleanoptional

    Enrol the shopper if not found. Set false to 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

GET/v1/loyalty/customers/{customerRef}/summary

Returns the member’s current points, points earned and spent so far, tier (e.g. Silver, Gold) and progress to the next tier.

Permission customer:readUse it for: a loyalty card in your app, "you have 1,250 points" in checkout.

Path parameters

  • customerRefstringrequired

    The 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

GET/v1/loyalty/customers/{customerRef}/rewards

Lists the coupons and rewards the member can use right now.

Permission customer:readUse it for: a "your rewards" list the shopper can pick from at checkout.

Path parameters

  • customerRefstringrequired

    The 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

POST/v1/loyalty/earn/preview

Calculates the points this cart would earn, including tier bonuses and product multipliers. Nothing is saved.

Permission customer:readUse it for: "Complete this order and earn 63 points".

Body parameters

  • customerRefstringrequired

    The member’s reference, returned by /identify.

  • cartobjectrequired

    The 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

POST/v1/loyalty/cart/quote

Works 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.

Permission customer:readUse it for: "Use 200 points — save ₹20" before payment.

Body parameters

  • customerRefstringrequired

    The member’s reference, returned by /identify.

  • cartobjectrequired

    The order — see the cart object.

  • appliedobjectoptional

    Points, 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)

POST/v1/loyalty/cart/commit

After 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.

Permission bill:writeUse it for: the moment payment succeeds.

Headers

  • Idempotency-Keystringrequired

    One unique value per order, e.g. order-100234. Retries with the same key return the first result.

Body parameters

  • customerRefstringrequired

    The member’s reference, returned by /identify.

  • externalOrderIdstringrequired

    Your order id. Use the same id for returns.

  • cartobjectrequired

    The order — see the cart object.

  • appliedobjectoptional

    Points, 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

POST/v1/loyalty/coupons/validate

Tells you whether a code is valid for this member and cart, and how much it takes off — or why it can’t be used.

Permission coupon:readUse it for: the "Apply coupon" box.

Body parameters

  • customerRefstringrequired

    The member’s reference, returned by /identify.

  • codestringrequired

    The coupon code the shopper entered.

  • cartobjectrequired

    The 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

POST/v1/loyalty/coupons/issue

Issues one of the merchant’s coupons to a shopper by mobile number or email, enrolling them if needed.

Permission coupon:writeUse it for: welcome offers, survey thank-yous, campaign rewards.

Body parameters

  • codestringrequired

    The merchant’s coupon to issue.

  • phonestring

    Mobile number of the shopper (or email).

  • countryCodestring

    Country calling code, e.g. 91.

  • namestring

    Name 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

POST/v1/loyalty/order/return

Takes back points earned on the order and gives back points that were spent.

Permission bill:writeUse it for: cancellations and returns in your order system.

Body parameters

  • orderIdstringrequired

    The same order id used at commit.

  • mobilestring

    Mobile number of the member.

  • purchase_datestring

    Date of the original order, YYYY-MM-DD.

  • reasonstring

    Why 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 change
  • Sale recorded

    Sent whenA bill or order is recorded
  • Sale reversed

    Sent whenA bill is refunded or an order cancelled
  • Visit milestones

    Sent whenFirst visit, every Nth visit, milestone reached
  • Lapsed and won back

    Sent whenA member goes inactive, or returns
  • Special dates

    Sent whenBirthdays and anniversaries (on the day and coming up)

Delivery

  • Method

    ValuePOST to your https address
  • Your reply

    ValueAny 2xx within 15 seconds
  • Retries

    ValueUp to 8 times, from 2 minutes to 1 hour apart
  • Duplicates

    ValueUse eventId to ignore repeats
  • Signature

    ValueX-OwnRewards-Signature: HMAC-SHA256 of timestamp.rawBody
  • Freshness

    ValueReject 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_error
    MeaningMissing or wrong field (details lists them)
  • 400

    Codeidempotency_key_required
    MeaningCommit sent without Idempotency-Key
  • 400

    Codeinsufficient_points
    MeaningNot enough points to redeem
  • 400

    Codereward_unavailablecoupon_invaliddiscount_exceeds_bill
    MeaningThe discount can’t be applied
  • 401

    Codeunauthorized
    MeaningKey or secret missing, wrong or revoked
  • 403

    Codeforbiddenoutlet_scope_mismatch
    MeaningMissing permission, or key locked to another outlet
  • 404

    Codecustomer_not_foundoutlet_not_foundcoupon_not_found
    MeaningNot found
  • 409

    Codeduplicate_ordercoupon_already_issued
    MeaningAlready done
  • 429

    Coderate_limited
    MeaningSlow down — see Retry-After
  • 500

    Codeinternal_error
    MeaningTemporary 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.

Request a test account