agora-org / agora

File server that accepts Lightning Network payments for downloads

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Automatic redirect on invoice page after invoice is settled

yzernik opened this issue · comments

When a user makes a payment on an invoice, they have to manually click another button to access the file after the payment completes.

It would be better if the browser automatically redirects to the file after the payment settles.

This could be done with the following:

  • Server Sent Events (SSE) from the server to the web browser client on the invoice page.
  • Use the SubscribeInvoices RPC method with streaming response to listen for settled invoices in LND.
  • When a settled invoice is found that matches the invoice payment hash, send a SSE event to the web frontend. This event can be handled by some Javascript code that tells the browser to redirect to the unlocked file page.