Your Coinbase payment integration has two issues:
- Frontend allows anonymous payments β Creates charges that can't be credited
- Balance doesn't update after payment β User thinks payment failed
I've fixed both issues in this repo (frontend), but you also need to apply fixes to the backend.
Files changed:
- β
src/components/billing/FundingSection.tsx - β
src/app/api/coinbase/charge/route.ts
Changes:
- Prevents anonymous payments (requires login)
- Refreshes balance after successful payment
- Better error messages and validation
Deploy: Ready to deploy now!
File to fix: Webhook handler at /api/v1/webhooks/coinbase
Changes needed:
- Add idempotency (prevent double-crediting)
- Better validation (handle missing user_id gracefully)
- Enhanced logging (easier debugging)
Instructions: See BACKEND_WEBHOOK_FIXES.md
From your logs, Coinbase was sending the same webhook multiple times because:
- First attempt: Webhook fails with "Missing user_id"
- Coinbase retry logic: Retries after 1s, 10s, 30s, 1m, 5m...
- Eventually succeeds: After several attempts
With the fixes:
- Frontend prevents creating charges without userId
- Backend handles invalid webhooks gracefully (doesn't throw β Coinbase won't retry)
- Result: Single webhook, single credit, happy users
1. Deploy Frontend (This Repo) - First
cd Morpheus-Marketplace-APP
git add .
git commit -m "fix: Coinbase payment validation and balance refresh"
git push origin main2. Deploy Backend (Other Repo) - Second
cd morpheus-marketplace-api
# Apply fixes from BACKEND_WEBHOOK_FIXES.md
git add .
git commit -m "fix: Coinbase webhook idempotency and validation"
git push origin main3. Test End-to-End
- Make test payment ($1)
- Check both frontend and backend logs
- Verify balance updates
- Check for duplicate credits
| File | What It Contains |
|---|---|
| ARCHITECTURE.md | System diagram, data flow, repository structure |
| BACKEND_WEBHOOK_FIXES.md | Python code fixes for backend webhook handler |
| COINBASE_PAYMENT_ISSUES.md | Original bug report with log analysis |
| COINBASE_FIXES_SUMMARY.md | Technical explanation of all changes |
| COINBASE_MIGRATION_GUIDE.md | Future migration to Payment Links API |
| QUICKSTART_DEPLOYMENT.md | Fast deployment guide |
| .env.example | Environment variables template |
Start here: Read ARCHITECTURE.md to understand the system
#!/bin/bash
# test-coinbase-payment.sh
echo "π§ͺ Testing Coinbase Payment Integration"
echo ""
echo "1. Testing anonymous payment prevention..."
echo " β Open app in incognito mode"
echo " β Go to /billing"
echo " β Check: 'Pay with Crypto' button disabled? β/β"
read -p " Press enter when checked..."
echo ""
echo "2. Testing payment flow..."
echo " β Login to app"
echo " β Click 'Pay with Crypto'"
echo " β Enter $1.00 amount"
echo " β Complete payment on Coinbase"
echo " β Wait 5 seconds"
echo " β Check: Balance increased by $1.00? β/β"
read -p " Press enter when checked..."
echo ""
echo "3. Checking backend logs..."
if command -v curl &> /dev/null; then
echo " Fetching recent webhooks..."
# Add your log query here
echo " β Check logs manually for 'Account credited successfully'"
else
echo " β οΈ curl not found, check logs manually"
fi
echo ""
echo "β
Test complete!"
echo " See logs for any errors"Simple explanation:
- This repo = Website (Next.js)
- Other repo = API server (Python)
- Coinbase sends webhooks to β API server (not website)
- I fixed: Website payment flow
- You need to fix: API server webhook handler
Architecture diagram: See ARCHITECTURE.md
Questions about:
- Frontend fixes β Check this repo's documentation
- Backend fixes β See
BACKEND_WEBHOOK_FIXES.md - Migration plan β See
COINBASE_MIGRATION_GUIDE.md - Architecture β See
ARCHITECTURE.md
Still stuck? File GitHub issue with:
- Which repo (frontend or backend)?
- Error message
- Logs
- Steps to reproduce
Created: February 12, 2026
Last updated: February 12, 2026
Status: Frontend fixes ready, backend fixes documented