- Open: https://app.supabase.com/project/gebpumzaljxpitwthzrb/sql/new
- Copy and paste this SQL:
ALTER TABLE payment_links
ADD COLUMN IF NOT EXISTS btc_address TEXT,
ADD COLUMN IF NOT EXISTS usdt_amount DECIMAL(20, 6),
ADD COLUMN IF NOT EXISTS bitnob_usdt_virtual_account_id TEXT,
ADD COLUMN IF NOT EXISTS payment_status TEXT DEFAULT 'pending',
ADD COLUMN IF NOT EXISTS usdt_tx_hash TEXT,
ADD COLUMN IF NOT EXISTS btc_tx_hash TEXT,
ADD COLUMN IF NOT EXISTS btc_amount DECIMAL(20, 8),
ADD COLUMN IF NOT EXISTS confirmed_at TIMESTAMP WITH TIME ZONE;
CREATE INDEX IF NOT EXISTS idx_payment_links_payment_status ON payment_links(payment_status);
CREATE INDEX IF NOT EXISTS idx_payment_links_usdt_account ON payment_links(bitnob_usdt_virtual_account_id);- Click Run
- Verify you see "Success" messages
Open a new terminal:
cd /Users/wandiamugo/DadaDevs/bitlancer/client
npm run devFrontend will start on: http://localhost:5173
- Login to BitLancer at http://localhost:5173
- Navigate to Payment Links
- Click "Create Payment Link"
- Fill in:
- Title: "Test USDT Payment"
- Amount: $100
- Click Create
- Copy the payment link URL
- Open the payment link in a new browser/incognito window
- You should see:
- Payment amount in USD
- Converted to BTC
- Converted to USDT ← New!
- Click the USDT payment method button
- Verify you see:
- ✅ USDT amount (should equal USD amount)
- ✅ Payment address (from Bitnob)
- ✅ QR Code (auto-generated)
- ✅ Network selector (TRC20/ERC20)
- ✅ "Open Wallet to Pay" button
- ✅ "I have sent the payment" button
Click "I have sent the payment" button:
- Status changes to: "Waiting for USDT payment confirmation..."
- Page starts polling every 10 seconds
- (In production, this waits for real USDT deposit)
Open another terminal and simulate a webhook:
# Get a payment link ID first from your database
# Then run this curl command:
curl -X POST http://localhost:50001/api/webhooks/bitnob \
-H "Content-Type: application/json" \
-H "x-bitnob-signature: df977ac59c7a6aa477b3" \
-d '{
"type": "usdt.deposit",
"data": {
"virtualCardId": "PASTE_VIRTUAL_CARD_ID_HERE",
"amount": 100,
"currency": "USDT",
"txHash": "0x123testinghash",
"sender": "0xabctestaddress"
}
}'Note: Get the virtualCardId from your payment_links table or create one first.
After simulating the webhook:
- Frontend status updates to: "USDT received! Converting to BTC..."
- Backend converts USDT → BTC (via Bitnob)
- Backend sends BTC to freelancer
- Status updates to: "BTC sent to freelancer! Finalizing..."
- Finally: "Payment Successful!" page appears
- ✅ Payment method switcher (USDT vs Card)
- ✅ QR code displays correctly
- ✅ QR code updates when switching networks
- ✅ Status polling works
- ✅ Success page shows after completion
Look for these logs:
💳 Creating USDT virtual card...
✅ USDT virtual card created!
💰 USDT deposit webhook received
🔄 Converting USDT to BTC and sending...
✅ BTC sent successfully!
-- View payment link details
SELECT
id, title, amount_usd, usdt_amount,
payment_status, usdt_tx_hash, btc_tx_hash
FROM payment_links
ORDER BY created_at DESC
LIMIT 5;
-- View transaction records
SELECT
type, amount_usd, amount_btc, payment_method, status
FROM transactions
ORDER BY created_at DESC
LIMIT 5;- Make sure you created a payment link first
- Check the URL has the correct link ID
- Open browser console (F12)
- Look for JavaScript errors
- Verify
qrcodelibrary is installed:npm list qrcode
- Verify backend is running on port 50001
- Check the
virtualCardIdmatches your payment link - Ensure webhook secret matches:
df977ac59c7a6aa477b3
- This is expected in sandbox mode
- Real Bitnob virtual cards require account setup
- For testing, focus on UI/UX flow
- Database migration completed
- Frontend server started
- Backend server running (already ✅)
- Created test payment link
- Opened public payment page
- Selected USDT payment method
- Verified QR code displays
- Tested network switching (TRC20/ERC20)
- Clicked "I have sent payment"
- Verified status polling works
- (Optional) Simulated webhook
- Verified success page displays
- Full Implementation Details:
/USDT_PAYMENT_IMPLEMENTATION_SUMMARY.md - Migration SQL:
/server/migrations/COPY_TO_SUPABASE_SQL_EDITOR.sql - Detailed Steps:
/server/MIGRATION_STEPS.md - Setup Test: Run
node server/test-setup.js
The USDT payment system is fully implemented and ready to test. Start with Step 1 (database migration) and follow through the steps above.
Happy Testing! 🚀