Live example
flashnet-onramp-example.vercel.app
Source code
github.com/flashnetxyz/pay-link-example
How do I open the Lightning app?
The Cash App payment URL is a deep link. It only works when the browser navigates to it. Afetch() call just downloads the HTML response and nothing visible happens.
Wrong:
How do I track order status with SSE?
Use Server-Sent Events for live order tracking. Connect through your proxy so the API key stays server-side. Close the connection on terminal statuses (completed, failed, refunded). Fall back to polling every 3 seconds if SSE disconnects.
Full useOrderSSE hook (src/lib/use-order-sse.ts)
Full useOrderSSE hook (src/lib/use-order-sse.ts)
How do I proxy the API key?
Keep the API key on the server. The browser calls your proxy, the proxy attaches theAuthorization header, and the response streams back. For SSE paths, the proxy streams the upstream body as-is with text/event-stream headers so the browser keeps the connection open.
SSE proxy handler (src/app/api/proxy/[...path]/route.ts)
SSE proxy handler (src/app/api/proxy/[...path]/route.ts)
How do I show pipeline progress?
Orders move through a sequence of statuses. Surface the current stage so the user knows the payment is working.| Status | Meaning |
|---|---|
confirming | Payment detected, waiting for confirmation |
swapping | Converting BTC to stablecoin |
bridging | Sending to destination chain (if applicable) |
completed | Funds delivered |