A robust, production-ready Clarity smart contract implementing a customer loyalty punch card system on the Stacks blockchain. Customers earn punches with each purchase and redeem them for rewards.
This contract manages:
- Customer Registration - Secure onboarding with duplicate prevention
- Punch Management - Track punches earned from purchases
- Reward Redemption - Redeem 10 punches for rewards
- Account Management - Activate/deactivate customer accounts
- Audit Trail - Complete history of all transactions
- One-time registration per principal
- Automatic initialization with 0 punches
- Prevents duplicate registrations
- Add punches to customer accounts (admin only)
- Track punch history with merchant and timestamp
- Automatic counter for audit purposes
- Redeem 10 punches for 100 STX equivalent reward
- Customer-initiated redemption
- Automatic punch deduction
- Admin can deactivate accounts
- Active status validation on all operations
- Prevents inactive customers from earning/redeeming
- Total punches issued
- Total rewards redeemed
- Per-customer statistics
Registers a new customer for the loyalty program.
(register-customer)