Merge pull request #12 from AustinKelsay/feature/detailed-payment-memos

Add memo with user id and content id when there are purchases or subscriptions
This commit is contained in:
Austin Kelsay 2025-03-02 17:33:38 -06:00 committed by GitHub
commit 0a3872b7f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View File

@ -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);

View File

@ -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) {

View File

@ -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);