Skip to content

๐ŸŽ Loyalty Program โ€‹

KitchenAsty includes a points-based loyalty program where customers earn points on purchases and redeem them for discounts.

Admin Loyalty

๐Ÿ’Ž How Points Work โ€‹

ActionPoints
๐Ÿ›’ Place an orderEarn points based on order total
๐ŸŽ Redeem pointsDeduct points for a discount
๐Ÿ”ง Admin adjustmentStaff can manually add or remove points

Points are tracked on the Customer model (loyaltyPoints field) and each transaction is recorded in the LoyaltyTransaction table.

๐Ÿ“Š Transaction Types โ€‹

TypeDescription
EARNโฌ†๏ธ Points earned from an order
REDEEMโฌ‡๏ธ Points spent for a discount
ADJUST๐Ÿ”ง Manual adjustment by staff

Each transaction records the points amount, a description, and optionally links to an order.

๐Ÿ‘ค Customer Endpoints โ€‹

๐Ÿ’ฐ Check Balance โ€‹

GET /api/loyalty/balance
Authorization: Bearer <customer-token>

Returns the customer's current point balance.

๐ŸŽ Redeem Points โ€‹

POST /api/loyalty/redeem
Authorization: Bearer <customer-token>

{
  "points": 100,
  "orderId": "order-id"
}

Deducts points from the customer's balance.

๐Ÿ› ๏ธ Admin Endpoints โ€‹

๐Ÿ”ง Adjust Points โ€‹

POST /api/loyalty/customers/:id/adjust
Authorization: Bearer <staff-token>

{
  "points": 50,
  "description": "Compensation for delayed order"
}

Adds or removes points. Use negative values to deduct.

๐Ÿ” Permissions โ€‹

ActionWho Can Do It
๐Ÿ’ฐ Check balanceAuthenticated customers
๐ŸŽ Redeem pointsAuthenticated customers
๐Ÿ”ง Adjust pointsManager, Super Admin

๐Ÿ“ก API โ€‹

See Loyalty API for the complete endpoint reference.