Instant international payments for Nigerian freelancers β powered by Stellar and stablecoins.
AfriPay enables freelancers to receive payments from global clients in minutes, not days, with fees under 1%. Blockchain complexity is completely abstracted β users see invoices, balances, and bank withdrawals, nothing else.
- Traditional payment methods (PayPal, Wise) charge 5β10% fees and take 3β7 days to settle
- Nigerian freelancers lose significant portions of their earnings to fees and exchange rate markups
- Crypto solutions are too complex for non-technical users
- Create invoice β Get a shareable payment link
- Client pays β Card payment converts to USDC on Stellar
- Instant settlement β Funds arrive in 3β5 seconds
- Withdraw to bank β Convert to NGN via Yellow Card, instant bank transfer
- Keep 99%+ β Fees under 1%, zero crypto knowledge required
| Layer | Technology |
|---|---|
| Frontend | Next.js 15 (App Router), React 19, Tailwind CSS v4 |
| Backend | Next.js API Routes, Prisma ORM, PostgreSQL (Neon) |
| Auth | Privy β OAuth + embedded Stellar wallets |
| Blockchain | Stellar Network β USDC stablecoin |
| On-ramp | MoonPay β card β USDC |
| Off-ramp | Yellow Card β USDC β NGN bank transfer |
| Resend | |
| Deployment | Vercel |
- β‘ 3β5 second settlement with fees < $0.01
- π¦ Yellow Card integration β direct off-ramp to Nigerian banks in 20+ African countries
- π 475,000+ on/off-ramp access points worldwide
- π Battle-tested β used by MoneyGram, Onafriq, and major African payment providers
- π° Low cost β ~$0.75 per wallet (XLM reserves) vs building custom infrastructure
Client Card Payment
β
MoonPay (Fiat β USDC on Stellar)
β
Freelancer's Stellar Wallet (Privy embedded)
β
Yellow Card API (USDC β NGN)
β
Nigerian Bank Account
afripay/
βββ app/
β βββ (auth)/ # Login, register, onboarding
β βββ (dashboard)/ # Authenticated app pages
β β βββ dashboard/ # Overview with stats
β β βββ invoices/ # Invoice list + create + detail
β β βββ withdrawals/ # Withdrawal history + initiate
β β βββ settings/ # Profile & wallet settings
β βββ api/
β β βββ invoices/ # CRUD
β β βββ moonpay/sign/ # Signed widget URL
β β βββ webhooks/ # MoonPay + Yellow Card
β β βββ withdrawals/ # Initiate + list
β β βββ wallet/balance/ # USDC balance
β β βββ users/onboard/ # Onboarding
β β βββ cron/ # Scheduled jobs
β βββ pay/[token]/ # Public payment page (no auth)
β βββ page.tsx # Landing page
βββ components/
β βββ ui/ # Badge, CopyButton, Toaster
β βββ dashboard/ # Stats, RecentInvoices
β βββ sidebar.tsx
β βββ navbar.tsx
β βββ payment-widget.tsx
β βββ providers.tsx
βββ hooks/
β βββ use-invoices.ts
β βββ use-wallet.ts
β βββ use-withdrawals.ts
βββ lib/
β βββ stellar.ts # Stellar SDK helpers
β βββ moonpay.ts # MoonPay URL signing + webhook verify
β βββ yellowcard.ts # Yellow Card API client
β βββ resend.ts # Email templates
β βββ auth.ts # Privy server-side auth
β βββ prisma.ts # Prisma singleton
β βββ utils.ts # cn(), formatDate(), formatCurrency()
βββ prisma/
β βββ schema.prisma # Database schema
β βββ seed.ts # Demo data
βββ docs/
βββ architecture.md # System design
βββ api.md # API reference
- Node.js β₯ 20
- PostgreSQL database (Neon free tier works)
- Privy app (free tier)
- MoonPay sandbox account
- Yellow Card sandbox account
- Resend account
# Clone the repo
git clone https://github.com/devUnixx/afripay.git
cd afripay
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env.local
# Edit .env.local with your credentials
# Push database schema
npx prisma db push
# (Optional) Seed demo data
npm run db:seed
# Start development server
npm run devOpen http://localhost:3000.
See .env.example for all required variables. Key ones:
| Variable | Description |
|---|---|
DATABASE_URL |
PostgreSQL connection string |
NEXT_PUBLIC_PRIVY_APP_ID |
Privy app ID |
PRIVY_APP_SECRET |
Privy app secret |
NEXT_PUBLIC_MOONPAY_API_KEY |
MoonPay publishable key |
MOONPAY_SECRET_KEY |
MoonPay secret key |
MOONPAY_WEBHOOK_SECRET |
MoonPay webhook signing secret |
YELLOW_CARD_API_KEY |
Yellow Card API key |
YELLOW_CARD_API_SECRET |
Yellow Card API secret |
RESEND_API_KEY |
Resend API key |
CRON_SECRET |
Secret for cron job authorization |
npm test # Run all tests
npm run test:ci # CI mode with coverage
npm run type-check # TypeScript check
npm run lint # ESLintConfigured in vercel.json and protected by CRON_SECRET.
| Job | Schedule | Description |
|---|---|---|
cancel-overdue-invoices |
0 2 * * * (daily 2AM UTC) |
Cancels PENDING invoices with dueDate > 90 days ago. Skips invoices with active escrow, active dispute, or doNotAutoCancel: true. |
Test locally:
curl -H "Authorization: Bearer YOUR_CRON_SECRET" \
http://localhost:3000/api/cron/cancel-overdue-invoices- Push to GitHub
- Import project in Vercel
- Add all environment variables from
.env.example - Deploy β cron jobs are configured automatically via
vercel.json
After deploying, configure these webhook URLs in your provider dashboards:
| Provider | Webhook URL |
|---|---|
| MoonPay | https://afripay.io/api/webhooks/moonpay |
| Yellow Card | https://afripay.io/api/webhooks/yellowcard |
Contributions are welcome! Please read CONTRIBUTING.md first.
- Fork the repo
- Create a branch:
git checkout -b feat/your-feature - Commit with conventional commits:
feat: add invoice PDF export - Open a pull request
- Architecture β system design and payment flow
- API Reference β all API endpoints
- Contributing β how to contribute
- Security β reporting vulnerabilities
Licensed under the Apache License 2.0.
Built with β€οΈ for Nigerian freelancers. Powered by Stellar.