This implements a full inline payment modal system that keeps users on ugig.net instead of redirecting to coinpayportal.com.
InlinePayModal.tsx— Modal with QR code display, copy-to-clipboard wallet address, 20-min countdown timer, real-time status polling every 5sapi-invoices-pay.ts— GET /api/invoices/[id]/pay — API route returning payment detailsapi-invoices-status.ts— GET /api/invoices/[id]/status — Polled by frontend for payment confirmationcoinpayportal-lib.ts— Updated lib/coinpayportal.ts with getPaymentStatus() and getPaymentQR() helpersPayApplicantButton.tsx— Updated button that shows inline payment instead of redirectwebhook-enhancement.ts— Webhook handler update to update gig_invoices on payment confirmationdashboard-invoices-page.tsx— Updated invoice dashboard page wiring up inline payment
- Poster clicks "Pay [WorkerName]"
- Modal opens with amount/notes form
- Poster submits → POST /api/gigs/[id]/invoice
- Backend creates CoinPay payment + local invoice record
- Backend returns: { payment_address, amount_crypto, currency, expires_at }
- Frontend shows inline payment UI with QR code, wallet address, copy button, countdown timer
- User sends crypto from their wallet
- Frontend polls GET /api/invoices/[id]/status every 5s
- CoinPay webhook → /api/payments/coinpayportal/webhook
- Webhook updates invoice status to "paid"
- Frontend polling detects status change → shows "✅ Paid!"