Skip to content

Wallets & Points

The wallet system provides a full double-entry ledger for managing customer points. Every transaction is recorded, providing a complete audit trail.

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

Add points to a customer’s wallet:

Terminal window
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"}
}'

Remove points from a customer’s wallet:

Terminal window
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"
}'
Terminal window
curl -X GET https://api.storelayer.io/v1/wallets/{customerId}/balance \
-H "Authorization: Bearer YOUR_API_KEY"

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"
}