Wallets & Points
The wallet system provides a full double-entry ledger for managing customer points. Every transaction is recorded, providing a complete audit trail.
How Wallets Work
Section titled “How Wallets Work”Each customer has one wallet per project. The wallet tracks:
- Balance — Current available points
- Lifetime earned — Total points ever credited
- Lifetime spent — Total points ever debited
- Transaction history — Every credit and debit with reasons
Operations
Section titled “Operations”Credit Points
Section titled “Credit Points”Add points to a customer’s wallet:
curl -X POST https://api.storelayer.io/v1/wallets/{customerId}/credit \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "amount": 100, "reason": "Purchase reward", "metadata": {"orderId": "ord_123"} }'Debit Points
Section titled “Debit Points”Remove points from a customer’s wallet:
curl -X POST https://api.storelayer.io/v1/wallets/{customerId}/debit \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "amount": 50, "reason": "Reward redemption" }'Check Balance
Section titled “Check Balance”curl -X GET https://api.storelayer.io/v1/wallets/{customerId}/balance \ -H "Authorization: Bearer YOUR_API_KEY"Transaction History
Section titled “Transaction History”Every wallet operation creates a transaction record:
{ "id": "txn_abc123", "type": "credit", "amount": 100, "balance": 350, "reason": "Purchase reward", "metadata": {"orderId": "ord_123"}, "createdAt": "2025-01-15T10:30:00Z"}