Feature: Membership-Based Discount System with Lightning Integration #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
This issue documents the implementation plan for a membership/loyalty system that allows users to receive tiered discounts AND automatic Lightning wallet integration by scanning a single membership ID (QR code or NFC) at the ATM.
Key Features:
Prerequisites
API Key Authentication
Before implementing this feature, we need API key authentication for programmatic access. See #2 for details.
User Flows
Cash-In Flow (User buys BTC with cash)
Cash-Out Flow (User sells BTC for cash)
Part 1: Database Schema Changes
New Tables
Seed Default Tiers
Part 2: Server API Changes
New Files
packages/server/lib/membership.js- Core membership validation servicepackages/server/lib/membership-lightning.js- Lightning Address resolutionpackages/server/lib/routes/membershipRoutes.js- REST endpoints for machineREST Endpoints
POST /membership/validate- Validate membership ID, return tier + discountPOST /membership/invoice- Get Lightning invoice for a member (for cash-in)GraphQL API (Admin)
Part 3: Machine Changes (lamassu-machine)
Modified Cash-In Flow
For members, skip the wallet address scan entirely:
New States
membershipPrompt- "Do you have a membership card?"membershipScan- Scan QR codemembershipResult- "Welcome Gold Member! 15% discount applied"membershipInvalid- "Membership not recognized"New Trader Methods
Part 4: Lightning Address Support
Users can connect various Lightning wallets that support Lightning Addresses:
Custodial
user@walletofsatoshi.comuser@getalby.comuser@blink.svuser@strike.meSelf-Custodial
Implementation Checklist
Phase 1: Database & Core API
membership.jsservicemembership-lightning.jsfor Lightning Address resolution/membership/validateREST endpoint/membership/invoiceREST endpointPhase 2: Machine Integration
Phase 3: Lightning Integration
Phase 4: Web App Integration
Related Issues
References
membership-discount-plan.mdin lamassu-stuff repoapi-key-auth-plan.mdin lamassu-stuff repo