A simple e-commerce application demonstrating the Blnk Finance Card Payment System.
- Card Account Creation: Create a Blnk Ledger, Identity, and Card Balance.
- Shop: Browse products and checkout using your Blnk Card.
- Authorization: Creates "inflight" transactions on the Blnk Ledger.
- Merchant Dashboard: View pending orders and Settle (Commit) or Reject (Void) them.
- A running instance of Blnk Core.
- Docker:
docker run -p 5001:5001 blnkfinance/blnk
- Docker:
- Node.js installed.
-
Install dependencies:
npm install
-
Configure Environment: Create a
.env.localfile in the root directory:BLNK_API_KEY=your_api_key_here BLNK_CORE_URL=http://localhost:5001
(If running locally without auth, you can leave API Key empty)
-
Run the development server:
npm run dev
-
Open http://localhost:3000 with your browser.
- Create Account: Enter your name and email. This calls the Blnk API to create your Ledger, Identity, and Card Balance. It also funds your card with $10,000 via a deposit from
@World. - Shop: Add items to cart and click "Pay". This creates an Inflight Transaction (Authorization).
- Merchant View: Click "Merchant View" in the navbar. You will see the pending transaction.
- Settle: Click "Accept" to commit the transaction (money moves permanently) or "Reject" to void it (hold is released).
- Next.js 14 (App Router)
- TypeScript
- Tailwind CSS
- Blnk TypeScript SDK
Next.js Server Actions run on the server, not in the browser. This means:
- API calls to Blnk Core happen server-side
- They won't appear in the browser's Network tab
- This is by design for security (API keys stay on server)
-
Terminal Logs (Recommended):
- Watch your terminal where
npm run devis running - You'll see detailed logs with emojis showing:
- ✅ Successful operations
- ❌ Errors with full details
- 📝 Transaction IDs and references
- 💰 Amounts and descriptions
- Watch your terminal where
-
Direct API Check (Quick verification):
- Open in browser:
https://your-blnk-core-url/ledgers - Or:
/balances,/transactions,/identities - You'll see JSON responses showing your data
- Open in browser:
-
Postman (For detailed testing):
- Create requests to test endpoints directly
- See full request/response details
- Check your terminal - Detailed error logs will show the actual API response
- Verify Blnk Core is running - Check if you can access
/ledgersin browser - Check balance - Ensure the card has sufficient funds
- Check destination format - Should be
@WorldUSDor@World-USDdepending on your Core version