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 only oncompleted, failed, or refunded. The server keeps the stream open on unfulfilled because a late deposit can revive the order; keep the stream open (or resubscribe) so you catch the resumption. 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.
Use the SSE status events to animate transitions between stages. The live example shows a step-by-step pipeline visualization with a countdown timer.