Skip to content
Loyvo

API reference

Loyalty API

Points, customers, branches and PIN-confirmed redemptions for your point-of-sale.

Run your loyalty programme from your point-of-sale or backend: enrol customers by phone number, award points on every purchase, and redeem them with a 4-digit PIN that Loyvo sends to the customer by SMS.

Authenticate every request with a live Loyvo API key (lvo_live_…, app.loyvo.lk → Settings → API keys) with loyalty:pos, or loyalty:read for reads, as a bearer token. Never put it in a mobile app or a web page.

A typical checkout:

  • Find the customer with GET /v1/loyalty/pos/customers/lookup, or enrol them with POST /v1/loyalty/pos/customers/quick-enroll.
  • Record the purchase with POST /v1/loyalty/pos/transactions to award points.
  • Redeem points with POST /v1/loyalty/pos/redemptions/initiate, then POST /v1/loyalty/pos/redemptions/confirm with the PIN the customer received.

All endpoints are under https://api.loyvo.lk/v1/loyalty and return JSON.

Base URL
https://api.loyvo.lk
Authentication
Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx

Use a live Loyvo API key with loyalty:pos (or loyalty:read for reads), sent as a bearer token. More about keys · Download OpenAPI

Authentication

Check your secret key

get/v1/loyalty/companies/verify-token

Protected endpoint to verify company authorization with header: Authorization: Bearer lvo_live_....

Returns

  • 200Success.
GET /v1/loyalty/companies/verify-token
curl "https://api.loyvo.lk/v1/loyalty/companies/verify-token" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx"
Response 200
{
  "status": "success",
  "message": "OK",
  "data": {
    "company_id": 1,
    "company_name": "Laundrix",
    "company_email": "nimali@example.com",
    "sms_id": 1,
    "branches_count": 1,
    "loyalty_config": {
      "points_earned": 1,
      "spend_amount": 1
    }
  }
}

Loyalty Configuration

Get your loyalty settings

get/v1/loyalty/companies/loyalty-config

Retrieves points_earned and spend_amount for the authenticated company.

Returns

  • 200Success.
GET /v1/loyalty/companies/loyalty-config
curl "https://api.loyvo.lk/v1/loyalty/companies/loyalty-config" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx"
Response 200
{
  "status": "success",
  "data": {
    "company_id": 1,
    "company_name": "Laundrix",
    "points_earned": 1,
    "spend_amount": 1
  }
}

Update your loyalty settings

patch/v1/loyalty/companies/loyalty-config

Allows a merchant to update their points_earned and spend_amount using their Company Secret Key

Body parameters

  • points_earnedinteger

    Points awarded per qualifying spend amount (integer, >= 1)

  • spend_amountinteger

    Qualifying spending amount required to earn points (integer, >= 1)

Returns

  • 200Success.
PATCH /v1/loyalty/companies/loyalty-config
curl -X PATCH "https://api.loyvo.lk/v1/loyalty/companies/loyalty-config" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "points_earned": 1,
  "spend_amount": 1
}'
Response 200
{
  "status": "success",
  "message": "OK",
  "data": {
    "company_id": 1,
    "company_name": "Laundrix",
    "points_earned": 1,
    "spend_amount": 1
  }
}

Branches

List branches

get/v1/loyalty/branches

Retrieves all branches belonging to the company identified by the Bearer secret key in the Authorization header.

Returns

  • 200Success.
GET /v1/loyalty/branches
curl "https://api.loyvo.lk/v1/loyalty/branches" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx"
Response 200
[
  {
    "id": 1,
    "company_id": 1,
    "company_name": "Laundrix",
    "branch_code": "…",
    "branch_name": "Colombo 03",
    "phone": "0771234567",
    "email": "nimali@example.com",
    "is_active": false,
    "created_at": "2026-11-17T10:00:00+05:30",
    "updated_at": "2026-11-17T10:00:00+05:30"
  }
]

Create a branch

post/v1/loyalty/branches

Creates a new branch directly under the company identified by the Bearer secret key.

Body parameters

  • branch_codestringRequired
  • branch_namestring
  • phonestring
  • emailstring or array

Returns

  • 201Created.
POST /v1/loyalty/branches
curl -X POST "https://api.loyvo.lk/v1/loyalty/branches" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "branch_code": "…",
  "branch_name": "Colombo 03",
  "phone": "0771234567",
  "email": "nimali@example.com"
}'
Response 201
{
  "id": 1,
  "company_id": 1,
  "company_name": "Laundrix",
  "branch_code": "…",
  "branch_name": "Colombo 03",
  "phone": "0771234567",
  "email": "nimali@example.com",
  "is_active": false,
  "created_at": "2026-11-17T10:00:00+05:30",
  "updated_at": "2026-11-17T10:00:00+05:30"
}

Get a branch

get/v1/loyalty/branches/{id}

Retrieves branch details. The branch must belong to the authenticated company.

Path parameters

  • idintegerRequired

Returns

  • 200Success.
GET /v1/loyalty/branches/{id}
curl "https://api.loyvo.lk/v1/loyalty/branches/abc123" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx"
Response 200
{
  "id": 1,
  "company_id": 1,
  "company_name": "Laundrix",
  "branch_code": "…",
  "branch_name": "Colombo 03",
  "phone": "0771234567",
  "email": "nimali@example.com",
  "is_active": false,
  "created_at": "2026-11-17T10:00:00+05:30",
  "updated_at": "2026-11-17T10:00:00+05:30"
}

Update a branch

put/v1/loyalty/branches/{id}

Path parameters

  • idintegerRequired

Body parameters

  • branch_codestringRequired
  • branch_namestring
  • phonestring
  • emailstring or array
  • is_activeboolean

Returns

  • 200Success.
PUT /v1/loyalty/branches/{id}
curl -X PUT "https://api.loyvo.lk/v1/loyalty/branches/abc123" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "branch_code": "…",
  "branch_name": "Colombo 03",
  "phone": "0771234567",
  "email": "nimali@example.com",
  "is_active": false
}'
Response 200
{
  "id": 1,
  "company_id": 1,
  "company_name": "Laundrix",
  "branch_code": "…",
  "branch_name": "Colombo 03",
  "phone": "0771234567",
  "email": "nimali@example.com",
  "is_active": false,
  "created_at": "2026-11-17T10:00:00+05:30",
  "updated_at": "2026-11-17T10:00:00+05:30"
}

Update part of a branch

patch/v1/loyalty/branches/{id}

Path parameters

  • idintegerRequired

Body parameters

  • branch_codestring
  • branch_namestring
  • phonestring
  • emailstring or array
  • is_activeboolean

Returns

  • 200Success.
PATCH /v1/loyalty/branches/{id}
curl -X PATCH "https://api.loyvo.lk/v1/loyalty/branches/abc123" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "branch_code": "…",
  "branch_name": "Colombo 03",
  "phone": "0771234567",
  "email": "nimali@example.com",
  "is_active": false
}'
Response 200
{
  "id": 1,
  "company_id": 1,
  "company_name": "Laundrix",
  "branch_code": "…",
  "branch_name": "Colombo 03",
  "phone": "0771234567",
  "email": "nimali@example.com",
  "is_active": false,
  "created_at": "2026-11-17T10:00:00+05:30",
  "updated_at": "2026-11-17T10:00:00+05:30"
}

Deactivate a branch

delete/v1/loyalty/branches/{id}

Sets is_active=False. Branch must belong to the authenticated company.

Path parameters

  • idintegerRequired

Returns

  • 200Success.
DELETE /v1/loyalty/branches/{id}
curl -X DELETE "https://api.loyvo.lk/v1/loyalty/branches/abc123" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx"
Response 200
{
  "status": "success",
  "message": "OK"
}

POS Operations

Find a customer by phone

get/v1/loyalty/pos/customers/lookup

Cashier enters mobile number. Returns customer profile and points balance if found, or prompts for enrollment if not found.

Query parameters

  • phonestringRequired

    Customer mobile number (e.g. 0771234567 or +94771234567)

Returns

  • 200Success.
  • 400The request is malformed, or a business rule failed.

Errors use the standard format. See Errors.

GET /v1/loyalty/pos/customers/lookup
curl "https://api.loyvo.lk/v1/loyalty/pos/customers/lookup?phone=0771234567" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx"
Response 200
{
  "status": "success",
  "exists": false,
  "data": {
    "id": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10",
    "phone": "0771234567",
    "first_name": "Nimali",
    "last_name": "Perera",
    "email": "nimali@example.com",
    "is_email_verified": false,
    "nic": "…",
    "points_balance": 1,
    "points_value_equivalent": 1,
    "registration_status": "basic",
    "created_by_branch": 1,
    "enrolled_date": "2026-11-17T10:00:00+05:30"
  },
  "has_offer": false,
  "offer_details": {},
  "message": "OK"
}

Enrol a customer at the counter

post/v1/loyalty/pos/customers/quick-enroll

Fast customer enrollment at till (< 200ms). Dispatches onboarding SMS with OTP and verification link in the background.

Body parameters

  • phonestringRequired

    Customer mobile number (e.g. 0771234567)

  • first_namestringRequired

    Customer first name

  • branch_idinteger

    Optional Branch ID where customer is enrolling

  • notifyboolean

    Send the welcome SMS with the digital card link (default true). False: enrol quietly, e.g. when a business imports its existing customers.

Returns

  • 201Created.
POST /v1/loyalty/pos/customers/quick-enroll
curl -X POST "https://api.loyvo.lk/v1/loyalty/pos/customers/quick-enroll" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "phone": "0771234567",
  "first_name": "Nimali",
  "branch_id": 1,
  "notify": true
}'
Response 201
{
  "status": "success",
  "message": "OK",
  "data": {
    "id": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10",
    "phone": "0771234567",
    "first_name": "Nimali",
    "last_name": "Perera",
    "email": "nimali@example.com",
    "is_email_verified": false,
    "nic": "…",
    "points_balance": 1,
    "points_value_equivalent": 1,
    "registration_status": "basic",
    "created_by_branch": 1,
    "enrolled_date": "2026-11-17T10:00:00+05:30"
  }
}

Record a purchase and award points

post/v1/loyalty/pos/transactions

Ingests purchase amount, calculates loyalty points based on merchant ratio, and updates customer balance atomically.

Body parameters

  • phonestringRequired
  • branch_idinteger
  • amountnumber (double)

    Transaction purchase amount in LKR (default: 1000.0)

  • invoice_idstring

    Optional merchant invoice/receipt number

  • get_offerboolean

    If true, redeems the active campaign offer for this customer at checkout

Returns

  • 201Created.
POST /v1/loyalty/pos/transactions
curl -X POST "https://api.loyvo.lk/v1/loyalty/pos/transactions" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "phone": "+94771234567",
  "branch_id": 1,
  "amount": 1000,
  "invoice_id": "INV-2026-001",
  "get_offer": false
}'
Response 201
{
  "status": "success",
  "message": "OK",
  "data": {
    "transaction_uuid": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10",
    "invoice_id": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10",
    "amount": 1,
    "net_amount": 1,
    "points_awarded": 1,
    "previous_balance": 1,
    "new_points_balance": 1,
    "customer_name": "…",
    "offer_redeemed": false,
    "offer_details": {}
  }
}

Get a transaction

get/v1/loyalty/pos/transactions/details

Fetches the complete details of a transaction using its transaction_uuid query parameter (e.g. ?transaction_uuid=tx_...) under the authenticated merchant company.

Query parameters

  • transaction_uuidstringRequired

    Unique transaction identifier (e.g., tx_9df3dceb...)

Returns

  • 200Success.
  • 400The request is malformed, or a business rule failed.
  • 404The endpoint or the object doesn't exist.

Errors use the standard format. See Errors.

GET /v1/loyalty/pos/transactions/details
curl "https://api.loyvo.lk/v1/loyalty/pos/transactions/details?transaction_uuid=6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx"
Response 200
{
  "status": "success",
  "data": {
    "transaction_uuid": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10",
    "amount": "…",
    "points_earned": 1,
    "invoice_id": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10",
    "branch": 1,
    "branch_name": "Colombo 03",
    "branch_code": "…",
    "customer": {
      "id": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10",
      "phone": "0771234567",
      "first_name": "Nimali",
      "last_name": "Perera",
      "email": "nimali@example.com",
      "is_email_verified": false,
      "nic": "…",
      "points_balance": 1,
      "points_value_equivalent": 1,
      "registration_status": "basic",
      "created_by_branch": 1,
      "enrolled_date": "2026-11-17T10:00:00+05:30"
    },
    "created_at": "2026-11-17T10:00:00+05:30"
  }
}

Correct a transaction

patch/v1/loyalty/pos/transactions/details

Updates a transaction by its transaction_uuid query parameter (?transaction_uuid=...). The request body ONLY requires amount. Loyalty points are automatically recalculated based on the merchant company spend rules, customer balance is atomically updated, and ledger & wallet passes are synchronized.

Query parameters

  • transaction_uuidstringRequired

    Unique transaction identifier as a query parameter (e.g. ?transaction_uuid=tx_9df3dceb...)

Body parameters

  • amountnumber (double)

    Updated transaction purchase amount in LKR

Returns

  • 200Success.
  • 400The request is malformed, or a business rule failed.
  • 404The endpoint or the object doesn't exist.
  • 422Validation failed: a field is missing or invalid.

Errors use the standard format. See Errors.

PATCH /v1/loyalty/pos/transactions/details
curl -X PATCH "https://api.loyvo.lk/v1/loyalty/pos/transactions/details?transaction_uuid=6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "amount": 2500
}'
Response 200
{
  "status": "success",
  "message": "OK",
  "data": {
    "transaction_uuid": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10",
    "invoice_id": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10",
    "amount": 1,
    "points_earned": 1,
    "points_delta": 1,
    "previous_points_balance": 1,
    "new_points_balance": 1,
    "customer_phone": "0771234567",
    "customer_name": "…",
    "updated_at": "…"
  }
}

Delete a customer

delete/v1/loyalty/pos/customers/delete

Permanently deletes an enrolled customer profile under this merchant company. Provide either customer mobile number or customer_id.

Query parameters

  • customer_idstring (uuid)

    Optional customer UUID

  • phonestring

    Customer mobile number (e.g. 0771234567 or +94771234567)

Returns

  • 200Success.
  • 400The request is malformed, or a business rule failed.
  • 404The endpoint or the object doesn't exist.

Errors use the standard format. See Errors.

DELETE /v1/loyalty/pos/customers/delete
curl -X DELETE "https://api.loyvo.lk/v1/loyalty/pos/customers/delete" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx"
Response 200
{
  "status": "success",
  "message": "OK",
  "data": {
    "customer_id": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10",
    "phone": "0771234567",
    "name": "Nimali Perera",
    "points_deleted": 1,
    "deleted_at": "…"
  }
}

Resend the wallet card link

post/v1/loyalty/pos/customers/resend-pass

Dispatches an onboarding SMS containing the direct Apple / Google Wallet pass link to the customer.

Body parameters

  • phonestringRequired

    Customer phone number

Returns

  • 200Success.
POST /v1/loyalty/pos/customers/resend-pass
curl -X POST "https://api.loyvo.lk/v1/loyalty/pos/customers/resend-pass" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "phone": "0771234567"
}'
Response 200
{
  "status": "success",
  "message": "OK",
  "wallet_pass_url": "https://loyvo.lk/"
}

POS Operations - Redemption

Start a points redemption

post/v1/loyalty/pos/redemptions/initiate

Initiates a points redemption at the POS till. Validates requested points against customer balance, calculates currency equivalent, generates a cryptographically secure 4-digit PIN with a 3-minute TTL, and sends it via SMS to the customer. No points are deducted until confirm succeeds.

Body parameters

  • phonestringRequired

    Customer mobile number (e.g. 0771234567)

  • points_to_redeemintegerRequired

    Loyalty points to redeem

  • branch_idinteger

    Till branch location ID

  • invoice_idstring

    Optional POS invoice / receipt reference

Returns

  • 200Success.
  • 404The endpoint or the object doesn't exist.
  • 422Validation failed: a field is missing or invalid.

Errors use the standard format. See Errors.

POST /v1/loyalty/pos/redemptions/initiate
curl -X POST "https://api.loyvo.lk/v1/loyalty/pos/redemptions/initiate" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "phone": "0771234567",
  "points_to_redeem": 1,
  "branch_id": 1,
  "invoice_id": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10"
}'
Response 200
{
  "status": "success",
  "message": "OK",
  "data": {
    "redemption_id": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10",
    "customer_name": "…",
    "phone": "0771234567",
    "current_balance": 1,
    "points_to_redeem": 1,
    "value_equivalent": 1,
    "projected_remaining_balance": 1,
    "expires_in_seconds": 1,
    "expires_at": "…"
  }
}

Confirm a redemption

post/v1/loyalty/pos/redemptions/confirm

Customer verbally reads the 4-digit PIN to cashier. On matching PIN, atomically debits points from balance, records an immutable negative delta in LoyaltyLedger, and marks redemption CONFIRMED.

Body parameters

  • redemption_idstringRequired

    Unique redemption ID issued at initiate step

  • pinstringRequired

    4-digit numeric PIN read by customer

Returns

  • 200Success.
  • 400The request is malformed, or a business rule failed.
  • 403The key is valid but not allowed to do this.
  • 409Conflict: the action no longer applies, or the same Idempotency-Key is still being processed.
  • 410No longer available, for example an expired PIN.

Errors use the standard format. See Errors.

POST /v1/loyalty/pos/redemptions/confirm
curl -X POST "https://api.loyvo.lk/v1/loyalty/pos/redemptions/confirm" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "redemption_id": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10",
  "pin": "…"
}'
Response 200
{
  "status": "success",
  "message": "OK",
  "data": {
    "redemption_id": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10",
    "customer_name": "…",
    "points_redeemed": 1,
    "discount_applied_amount": 1,
    "previous_balance": 1,
    "new_points_balance": 1,
    "ledger_reference": "…",
    "confirmed_at": "…"
  }
}

Resend the redemption PIN

post/v1/loyalty/pos/redemptions/resend-pin

Dispatches a fresh 4-digit PIN via SMS, resets attempt count, and renews the 3-minute timer.

Body parameters

  • redemption_idstringRequired

    Active redemption ID

Returns

  • 200Success.
POST /v1/loyalty/pos/redemptions/resend-pin
curl -X POST "https://api.loyvo.lk/v1/loyalty/pos/redemptions/resend-pin" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "redemption_id": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10"
}'
Response 200
{
  "status": "success",
  "message": "OK",
  "data": {
    "redemption_id": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10",
    "expires_in_seconds": 1,
    "expires_at": "…"
  }
}

Cancel or reverse a redemption

post/v1/loyalty/pos/redemptions/cancel

Handles cancellation of pending redemptions (customer abandoned till) and reversals of confirmed redemptions (POS sale voided/refunded). Points are restored automatically if already debited.

Body parameters

  • redemption_idstringRequired

    Redemption ID to cancel or reverse

  • reasonstring

    Optional cancellation or void reason

Returns

  • 200Success.
POST /v1/loyalty/pos/redemptions/cancel
curl -X POST "https://api.loyvo.lk/v1/loyalty/pos/redemptions/cancel" \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "redemption_id": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10",
  "reason": "Cancelled / voided at POS till"
}'
Response 200
{
  "status": "success",
  "action": "…",
  "message": "OK",
  "data": {
    "redemption_id": "6c0f2b9e-1d2a-4c7e-9a51-0b7e4d2f3a10",
    "points_restored": 1,
    "previous_balance": 1,
    "new_points_balance": 1,
    "reversal_ledger_reference": "…",
    "status": "success"
  }
}