Custom Payment Link Generator

Custom Payment Link Generator

Create and share secure payment links in seconds.

1. Enter Payment Details

Your generated link will appear here.

To: ${data.customer || 'N/A'}

Description: ${data.desc}

Amount: ${data.amount.toFixed(2)} ${data.currency}

Reference: ${data.ref || 'N/A'}

`; renderQRCode(); } function renderQRCode() { const container = document.getElementById('qr-code'); container.innerHTML = ''; for (let i = 0; i < 225; i++) { const dot = document.createElement('div'); if (Math.random() > 0.5) { dot.className = 'qr-dot'; } container.appendChild(dot); } } function copyLink() { const linkInput = document.getElementById('generatedLink'); linkInput.select(); document.execCommand('copy'); const copyBtn = document.getElementById('copyBtn'); copyBtn.textContent = 'Copied!'; setTimeout(() => { copyBtn.textContent = 'Copy'; }, 2000); } async function generatePdf() { document.getElementById('pdf-date').textContent = new Date().toLocaleDateString(); const summaryContainer = document.getElementById('pdf-summary'); summaryContainer.innerHTML = `

To: ${lastGeneratedData.customer || 'N/A'}

Description: ${lastGeneratedData.desc}

Amount: ${lastGeneratedData.amount.toFixed(2)} ${lastGeneratedData.currency}

Reference ID: ${lastGeneratedData.ref || 'N/A'}

Payment Link: ${lastGeneratedData.url}

`; const reportEl = document.getElementById('pdf-report'); reportEl.classList.remove('hidden'); const canvas = await html2canvas(reportEl, { scale: 2 }); reportEl.classList.add('hidden'); const imgData = canvas.toDataURL('image/png'); const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'p', unit: 'in', format: 'letter' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save('Payment-Link-Summary.pdf'); } document.getElementById('generateBtn').addEventListener('click', generateLink); document.getElementById('copyBtn').addEventListener('click', copyLink); document.getElementById('downloadPdfBtn').addEventListener('click', generatePdf); });
Scroll to Top