Skip to content

Commit

Permalink
Add instructions to LN invoice.
Browse files Browse the repository at this point in the history
This commit adds instructions to each LN invoice to guide users on what
to do next.

Signed-off-by: Daniel D’Aquino <[email protected]>
Link: [email protected]
Signed-off-by: William Casarin <[email protected]>
  • Loading branch information
danieldaquino authored and jb55 committed Jan 31, 2024
1 parent 607bad8 commit 7133328
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/invoicing.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ const { v4: uuidv4 } = require('uuid')
const PURPLE_ONE_MONTH = "purple_one_month"
const PURPLE_ONE_YEAR = "purple_one_year"
const PURGE_OLD_INVOICES = false // Disabled for now as we would like to keep records of all invoices
const LN_INVOICE_INSTRUCTIONS = `
INSTRUCTIONS:
1. Pay for this invoice using your Lightning wallet.
2. Once paid, please go back to the checkout page you were on. In iOS you can use the app switcher to go back to the browser.
3. Follow the instructions on the checkout page to complete checkout.
`;

function getInvoiceTemplates() {
return process.env.TEST_PRODUCTS ?
Expand Down Expand Up @@ -150,7 +156,7 @@ class PurpleInvoiceManager {
}

const template = this.invoice_templates[template_name]
const description = template.description + "\nnpub: " + npub
const description = template.description + "\nnpub: " + npub + "\n\n" + LN_INVOICE_INSTRUCTIONS
const amount_msat = template.amount_msat
const label = `lnlink-purple-invoice-${uuidv4()}`
// TODO: In the future, we might want to set specific expiry times and mechanisms to avoid having the user pay a stale/unmonitored invoice, and to relieve the server from having to monitor invoices forever.
Expand Down

0 comments on commit 7133328

Please sign in to comment.