Pass back payment hash

This commit is contained in:
austinkelsay 2024-11-06 16:57:13 -06:00
parent 08dc929a5d
commit ff4b9d8ac9
No known key found for this signature in database
GPG Key ID: 44CB4EC6D9F2FA02
2 changed files with 3 additions and 2 deletions

View File

@ -76,7 +76,7 @@ export default async function handler(req, res) {
'Authorization': PLEBDEVS_API_KEY 'Authorization': PLEBDEVS_API_KEY
} }
}); });
res.status(200).json({ pr: response.data, verify: `${BACKEND_URL}/api/lightning-address/verify/${slug}/${response.data.payment_hash}` }); res.status(200).json({ pr: response.data.invoice, verify: `${BACKEND_URL}/api/lightning-address/verify/${slug}/${response.data.payment_hash}` });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
res.status(500).json({ error: 'Failed to generate invoice' }); res.status(500).json({ error: 'Failed to generate invoice' });

View File

@ -58,6 +58,7 @@ export default async function handler(req, res) {
}); });
const invoice = response.data.payment_request; const invoice = response.data.payment_request;
const paymentHash = response.data.r_hash;
// If this is a zap, publish a zap receipt // If this is a zap, publish a zap receipt
if (zap_request && foundAddress.allowsNostr) { if (zap_request && foundAddress.allowsNostr) {
@ -84,7 +85,7 @@ export default async function handler(req, res) {
console.log("ZAP RECEIPT PUBLISHED", signedZapReceipt); console.log("ZAP RECEIPT PUBLISHED", signedZapReceipt);
} }
res.status(200).json(invoice); res.status(200).json({ invoice, payment_hash: paymentHash });
} catch (error) { } catch (error) {
console.error('Error (server) fetching data from LND:', error.message); console.error('Error (server) fetching data from LND:', error.message);
res.status(500).json({ message: 'Error fetching data' }); res.status(500).json({ message: 'Error fetching data' });