diff --git a/pages/[username]/print.tsx b/pages/[username]/print.tsx
index 696e5df3..33b261a3 100644
--- a/pages/[username]/print.tsx
+++ b/pages/[username]/print.tsx
@@ -7,7 +7,7 @@ import originalUrl from "original-url"
import ReactToPrint from "react-to-print"
import { bech32 } from "bech32"
import { QRCode } from "react-qrcode-logo"
-import { useRef, useState } from "react"
+import { useRef } from "react"
export async function getServerSideProps({
req,
@@ -18,19 +18,25 @@ export async function getServerSideProps({
}) {
const url = originalUrl(req)
+ const lnurl = bech32.encode(
+ "lnurl",
+ bech32.toWords(
+ Buffer.from(
+ `${url.protocol}//${url.hostname}/.well-known/lnurlp/${username}`,
+ "utf8",
+ ),
+ ),
+ 1500,
+ )
+
+ // Note: add the port to the webURL for local development
+ const webURL = `${url.protocol}//${url.hostname}/${username}`
+
+ const qrCodeURL = (webURL + "?lightning=" + lnurl).toUpperCase()
+
return {
props: {
- lnurl: bech32.encode(
- "lnurl",
- bech32.toWords(
- Buffer.from(
- `${url.protocol}//${url.hostname}/.well-known/lnurlp/${username}`,
- "utf8",
- ),
- ),
- 1500,
- ),
- webURL: `${url.protocol}//${url.hostname}/${username}`,
+ qrCodeURL,
username,
userHeader: `${username}'s paycode`,
},
@@ -38,19 +44,16 @@ export async function getServerSideProps({
}
export default function ({
- lnurl,
- webURL,
+ qrCodeURL,
username,
userHeader,
}: {
lightningAddress: string
- lnurl: string
- webURL: string
+ qrCodeURL: string
username: string
userHeader: string
}) {
const componentRef = useRef