Accept Kaspa cryptocurrency payments with near-zero fees and instant confirmations. The Stripe for Kaspa.
Built for Kaspathon 2026 | Track: Payments & Commerce
Live Demo | API Docs | Interactive Demo | Demo Video
KasPay is a complete payment gateway that lets merchants accept Kaspa (KAS) payments. Merchants create payment links, share them with customers, and receive KAS directly to their wallet with real-time blockchain verification.
Key features:
- Instant verification - UTXO matching + balance polling via Kaspa REST API for real-time confirmation
- Unique payment amounts - Random sompi nonce per payment to differentiate concurrent transactions
- Payment links - Create shareable links with QR codes for any amount (KAS or USD)
- Customer tracking - Attach customer name/email to payment links and view on receipts
- Sender address tracking - Automatically records the sender's Kaspa address from transaction inputs
- Draft & publish workflow - Save links as drafts, edit and publish when ready, set link expiration
- Merchant dashboard - Track payments with sender/receiver addresses, revenue charts, CSV export
- Editable wallet - Change your receiving Kaspa address anytime from settings
- Webhooks - Get notified via HTTP when payments are confirmed (HMAC-SHA256 signed)
- Embeddable buttons - Copy-paste HTML to add "Pay with Kaspa" to any website (3 styles)
- REST API - 15 endpoints for full programmatic integration
- Payment receipts - Detailed receipts with customer info, sender/receiver addresses, TX ID
- Interactive demo - Try the payment flow without real crypto at
/demo - Near-zero fees - Only Kaspa network fees (< $0.01)
- Dark/Light mode - Neobrutalism UI with theme toggle
Customer KasPay Kaspa Blockchain
| | |
|-- Opens payment link ->| |
|<- QR code + address ---| |
| | |
|-- Sends KAS ---------->|----------(on-chain)------->|
| | |
| |-- Polls balance/UTXOs ---->|
| |<- Confirmed! --------------|
|<- Payment confirmed! --| |
| |-- Webhook to merchant |
How payment verification works:
- Customer visits
/pay/[slug], which creates a payment session with a unique amount (base amount + random 1-9999 sompi nonce) - Frontend polls
GET /api/payments/:id/statusevery 2 seconds - Backend calls Kaspa REST API (
api-tn10.kaspa.orgfor testnet):- Primary: UTXO matching -
GET /addresses/{addr}/utxosscans for a UTXO matching the exact expected sompi amount. This uniquely identifies the payment even with concurrent transactions. - Fallback: Balance check -
GET /addresses/{addr}/balanceverifies balance >= initialBalance + expectedAmount
- Primary: UTXO matching -
- On match, fetches
GET /transactions/{txId}to extract the sender's address from transaction inputs - Payment is marked "confirmed", sender address saved, and webhook fires
No smart contracts needed - Kaspa is UTXO-based (like Bitcoin). The unique sompi nonce ensures each payment has a distinct amount, allowing precise UTXO matching even when multiple customers pay via the same merchant address simultaneously.
| Layer | Technology | Why |
|---|---|---|
| Framework | Next.js 14 (App Router) | Full-stack React with API routes |
| Language | TypeScript | Type safety |
| Database | Neon PostgreSQL + Drizzle ORM | Serverless Postgres, type-safe ORM |
| Styling | Tailwind CSS | Utility-first CSS with neobrutalism design |
| UI Components | shadcn/ui pattern (custom) | Accessible, composable |
| Auth | JWT + bcrypt | Stateless authentication |
| Blockchain | Kaspa REST API | Real-time balance/UTXO queries |
| Charts | Recharts | Dashboard analytics |
| Animations | Framer Motion | Smooth page transitions |
| QR Codes | qrcode.react | SVG QR code generation (Kaspa URI scheme) |
| Validation | Zod | Runtime type validation on all endpoints |
kaspay/
├── app/
│ ├── (auth)/ # Login & register pages
│ ├── (dashboard)/ # Merchant dashboard (protected)
│ │ ├── dashboard/ # Analytics overview with charts
│ │ ├── payments/ # Payment history table with search/filter/CSV export
│ │ ├── links/ # Payment link management (create/draft/publish)
│ │ ├── webhooks/ # Webhook configuration & event subscriptions
│ │ └── settings/ # API keys, editable wallet address, payment timeout
│ ├── pay/[slug]/ # Customer payment page (QR + live status + countdown)
│ ├── receipt/[id]/ # Payment receipt page
│ ├── demo/ # Interactive payment demo (no real crypto)
│ ├── docs/ # API documentation
│ └── api/ # REST API routes
│ ├── auth/ # Register, login, me
│ ├── links/ # CRUD payment links
│ ├── payments/ # Create & poll payments
│ ├── webhooks/ # Webhook management
│ ├── dashboard/ # Analytics stats
│ ├── settings/ # User settings
│ ├── network/ # Kaspa network info
│ └── price/ # KAS/USD price (CoinGecko)
├── lib/
│ ├── db/ # Drizzle schema & Neon client
│ ├── auth/ # JWT utils & React auth context
│ ├── kaspa/ # Kaspa REST API client (balance, UTXOs, network)
│ └── webhooks/ # Webhook delivery with HMAC-SHA256 signing
└── components/ui/ # Reusable UI components (Button, Card, Badge, etc.)
- Node.js 18+
- A Neon PostgreSQL database (free at neon.tech)
- A Kaspa wallet address (mainnet or testnet)
git clone https://github.com/PugarHuda/kaspay.git
cd kaspay
npm installCopy .env.example to .env.local and fill in:
# Database
DATABASE_URL="postgresql://user:pass@ep-xxx.neon.tech/kaspay?sslmode=require"
# Auth
JWT_SECRET="generate-a-strong-random-secret"
# Kaspa API (use testnet for development)
KASPA_API_URL="https://api-tn10.kaspa.org" # testnet
# KASPA_API_URL="https://api.kaspa.org" # mainnet
KASPA_NETWORK="testnet-10"
# App URL
NEXT_PUBLIC_APP_URL="http://localhost:3000"npm run db:pushnpm run devOpen http://localhost:3000.
npm run build
npm start- Push to GitHub
- Import repo on vercel.com
- Add environment variables (DATABASE_URL, JWT_SECRET, KASPA_API_URL, NEXT_PUBLIC_APP_URL)
- Deploy
Protected endpoints require a JWT token in the Authorization header:
Authorization: Bearer <your-jwt-token>
Get your token by calling POST /api/auth/register or POST /api/auth/login.
| Endpoint | Method | Auth | Description |
|---|---|---|---|
/api/auth/register |
POST | No | Create merchant account |
/api/auth/login |
POST | No | Authenticate & get JWT token |
/api/auth/me |
GET | Yes | Get current user profile & API key |
/api/links |
POST | Yes | Create payment link |
/api/links |
GET | Yes | List all payment links |
/api/links/:id |
PATCH | Yes | Update link (e.g., publish draft) |
/api/payments |
POST | No | Create payment session from link |
/api/payments/:id/status |
GET | No | Poll payment status (blockchain check) |
/api/payments |
GET | Yes | List all merchant payments |
/api/webhooks |
POST | Yes | Register webhook endpoint |
/api/webhooks |
GET | Yes | List registered webhooks |
/api/dashboard/stats |
GET | Yes | Dashboard analytics (volume, charts) |
/api/settings |
PATCH | Yes | Update wallet address & payment timeout |
/api/price |
GET | No | Get live KAS/USD price (CoinGecko) |
/api/network |
GET | No | Get Kaspa network stats (blocks, DAA) |
Full interactive documentation available at /docs.
| Event | Description |
|---|---|
payment.confirmed |
Payment verified on blockchain |
payment.expired |
Payment session timed out |
* |
Subscribe to all events |
Each delivery includes an X-KasPay-Signature header (HMAC-SHA256) and X-KasPay-Event header.
- Network: Testnet-10 (for development), Mainnet (for production)
- REST API:
https://api-tn10.kaspa.org(testnet) /https://api.kaspa.org(mainnet) - Explorer:
https://explorer-tn10.kaspa.org(testnet) /https://explorer.kaspa.org(mainnet) - Faucet:
https://faucet-tn10.kaspanet.io(testnet coins for testing) - Address format:
kaspatest:(testnet) orkaspa:(mainnet) - Balance unit: API returns sompi (1 KAS = 100,000,000 sompi)
- Verification: UTXO matching (primary) + balance check (fallback) + sender address extraction
- Price feed: CoinGecko API with 60-second cache
If you see this error in Kaspium or another mobile wallet:
gRPC Error (code: 14, codeName: UNAVAILABLE,
message: Error connecting: SocketException: Failed host lookup: 'tn10.kaspa.org')
This means the default public gRPC node tn10.kaspa.org is no longer reachable. This is a wallet-side issue, not a KasPay issue. KasPay uses the REST API (api-tn10.kaspa.org) which is separate.
Solutions:
- Check active TN10 nodes at nodes-tn10.kaspa.ws and set a custom gRPC endpoint in your wallet settings
- Use Kaspa-NG wallet which has built-in Testnet-10 support and auto-discovers peers
- Use the Web Wallet or Kaspa CLI wallet connected to a working TN10 node
- Run your own TN10 node - see Kaspa TN10 setup guide
- Ensure
KASPA_API_URLin.env.localpoints to the correct network - Check that the merchant wallet address prefix matches the network (
kaspatest:for testnet,kaspa:for mainnet) - Verify the Kaspa REST API is reachable:
curl https://api-tn10.kaspa.org/info/blockdag
- Ensure
DATABASE_URLincludes?sslmode=requirefor Neon PostgreSQL - Run
npm run db:pushto create/update the schema
5 tables with relations:
- users - Merchant accounts (email, password hash, Kaspa address, API key)
- paymentLinks - Payment links (title, amount, currency, slug, expiry, status)
- payments - Payment sessions (amount expected/received, sender address, TX ID, customer info, status)
- webhooks - Webhook endpoints (URL, events, HMAC secret, active flag)
- webhookLogs - Delivery logs (status code, response, errors)
As required by Kaspathon rules, here is a transparent and detailed disclosure of AI usage in this project. Per the rules: "participants must clearly document where & how AI was used."
Claude Code (Anthropic's CLI coding assistant, model: Claude Opus 4.6)
| Area | Files | What AI Did | What Developer Did |
|---|---|---|---|
| Database Schema | lib/db/schema.ts |
Generated Drizzle ORM table definitions based on developer's data model spec | Designed the 5-table schema (users, paymentLinks, payments, webhooks, webhookLogs), defined all fields and relations |
| API Routes | app/api/**/*.ts (15 endpoints) |
Generated boilerplate for route handlers, Zod validation schemas, and CRUD logic | Specified each endpoint's behavior, auth requirements, and business logic; designed the payment verification flow |
| Kaspa Integration | lib/kaspa/rpc.ts |
Wrote the KaspaAPI client class based on developer's API research | Developer researched Kaspa REST API docs, identified correct endpoints (/addresses/{addr}/balance, /utxos), tested against live TN10 API |
| Payment Verification | app/api/payments/[id]/status/route.ts |
Generated the polling logic skeleton | Developer designed the verification algorithm (initialBalance + expectedAmount comparison), debugged cache issues with cache: "no-store" |
| UI Pages | app/page.tsx, app/docs/page.tsx, app/demo/page.tsx, app/pay/[slug]/page.tsx, app/(dashboard)/** |
Generated React component code, Tailwind styling, Framer Motion animations | Developer chose neobrutalism design system, specified layout, UX flow, color scheme, and all user interactions |
| Auth System | lib/auth/jwt.ts, lib/auth/context.tsx |
Generated JWT utilities and React auth context | Developer chose JWT + bcrypt approach, set security parameters (12 salt rounds, 7-day expiry) |
| Webhook System | lib/webhooks/deliver.ts |
Generated HMAC-SHA256 signing and delivery logic | Developer designed webhook event system and payload format |
| Documentation | README.md, app/docs/page.tsx |
Helped write and structure documentation, API reference tables, troubleshooting guides | Developer provided all technical content, verified accuracy, wrote architecture explanations |
| Embed System | app/(dashboard)/links/page.tsx (embed modal) |
Generated HTML embed code templates and preview UI | Developer designed 3 embed styles (button/card/minimal) and the neobrutalism styling |
- Developer designs - Architecture, data model, UX flow, and feature specs were all decided by the developer before any code generation
- Developer prompts AI - Specific, detailed prompts describing exactly what each component should do (e.g., "create a payment status polling endpoint that checks Kaspa REST API balance and UTXOs")
- AI generates code - Claude Code produced initial implementations based on the developer's specifications
- Developer reviews & tests - All generated code was reviewed, tested against live Kaspa Testnet-10, and iterated on
- Developer debugs - Integration issues (e.g., Next.js fetch caching returning stale blockchain data, Zod v4 breaking changes, Drizzle-kit config) were identified through testing and fixed with AI assistance
- Product vision: Conceived KasPay as "Stripe for Kaspa" - a full payment gateway, not just a simple send/receive tool
- Architecture design: Chose balance-polling verification over websockets, UTXO-based TX ID extraction, REST API over gRPC
- Kaspa blockchain research: Studied Kaspa's UTXO model, sompi units, address formats, REST API capabilities, and testnet infrastructure
- Tech stack selection: Chose Next.js 14, Neon PostgreSQL, Drizzle ORM, Tailwind, and all dependencies
- UX/UI design decisions: Neobrutalism design system, payment flow (QR + countdown + confetti), mobile responsive layout, dark/light mode
- Testing with real transactions: Sent real testnet KAS to verify the payment flow end-to-end
- Deployment & infrastructure: Set up Neon database, Vercel deployment, environment configuration
- Feature design: Draft/publish workflow, link expiration, customer fields, embed styles, CSV export, webhook events
- Did not make any product or design decisions
- Did not deploy the application or configure infrastructure
- Did not test with real Kaspa transactions
- Did not research or choose the Kaspa blockchain integration approach
- Did not design the database schema or API architecture (it implemented the developer's designs)
- All blockchain integration logic was verified by the developer against live Kaspa Testnet-10 API responses
The full git commit history is available to verify the development timeline and progression of work done during the hackathon period.
| Requirement | Status |
|---|---|
| GitHub Repository | This repo |
| Live Demo | kaspay-flame.vercel.app |
| Interactive Demo | /demo |
| Demo Video (3 min) | Watch on YouTube |
| Screenshot | ./public/kaspay-home.png |
| README with setup | This file |
| AI Usage Disclosure | See above |
| Open Source | MIT License |
For Kaspa Hackathon prize distribution, this is the official wallet address associated with this project:
Kaspa Wallet Address: kaspa:qqvewdqutqnqud9qlhz38qacv2r9rwcag2c3v8qlpkg7rad34av4g6jmqpw0y
This address is also shared via official communication channels (Discord & DoraHacks) for verification purposes.
MIT
Built with love for the Kaspa community. Kaspathon 2026.

