From c760de1a9d4d0512311995632cac4950287d8c1f Mon Sep 17 00:00:00 2001 From: austinkelsay Date: Sun, 2 Mar 2025 17:28:40 -0600 Subject: [PATCH] Add memo with user id and content id when there are purchases or subscriptions --- src/components/bitcoinConnect/CoursePaymentButton.js | 3 ++- src/components/bitcoinConnect/ResourcePaymentButton.js | 2 +- src/components/bitcoinConnect/SubscriptionPaymentButton.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/bitcoinConnect/CoursePaymentButton.js b/src/components/bitcoinConnect/CoursePaymentButton.js index c7d2447..9f395eb 100644 --- a/src/components/bitcoinConnect/CoursePaymentButton.js +++ b/src/components/bitcoinConnect/CoursePaymentButton.js @@ -79,7 +79,8 @@ const CoursePaymentButton = ({ lnAddress, amount, onSuccess, onError, courseId } const ln = new LightningAddress(lnAddress); await ln.fetch(); const invoice = await ln.requestInvoice({ - satoshi: discountApplied ? calculateDiscount(amount).discountedAmount : amount + satoshi: discountApplied ? calculateDiscount(amount).discountedAmount : amount, + comment: `Course Purchase: ${courseId}, User: ${session?.user?.id}` }); setInvoice(invoice); setDialogVisible(true); diff --git a/src/components/bitcoinConnect/ResourcePaymentButton.js b/src/components/bitcoinConnect/ResourcePaymentButton.js index 3ede57b..959b1ee 100644 --- a/src/components/bitcoinConnect/ResourcePaymentButton.js +++ b/src/components/bitcoinConnect/ResourcePaymentButton.js @@ -54,7 +54,7 @@ const ResourcePaymentButton = ({ lnAddress, amount, onSuccess, onError, resource try { const ln = new LightningAddress(lnAddress); await ln.fetch(); - const invoice = await ln.requestInvoice({ satoshi: amount }); + const invoice = await ln.requestInvoice({ satoshi: amount, comment: `Resource Purchase: ${resourceId}, User: ${session?.user?.id}` }); setInvoice(invoice); setDialogVisible(true); } catch (error) { diff --git a/src/components/bitcoinConnect/SubscriptionPaymentButton.js b/src/components/bitcoinConnect/SubscriptionPaymentButton.js index d0ad66f..753ae64 100644 --- a/src/components/bitcoinConnect/SubscriptionPaymentButton.js +++ b/src/components/bitcoinConnect/SubscriptionPaymentButton.js @@ -60,7 +60,7 @@ const SubscriptionPaymentButtons = ({ onSuccess, onError, onRecurringSubscriptio try { const ln = new LightningAddress(lnAddress); await ln.fetch(); - const newInvoice = await ln.requestInvoice({ satoshi: amount }); + const newInvoice = await ln.requestInvoice({ satoshi: amount, comment: `Subscription Purchase. User: ${session?.user?.id}` }); return newInvoice; } catch (error) { console.error('Error fetching invoice:', error);