Skip to content

Invoice Deep-Link Generator with Pre-Filled Amount #422

Description

@Kingsman-99

Description

Sales teams and freelancers often want to share a payment link that pre-fills a specific amount for the recipient to complete and send, acting as a lightweight invoice-request flow. This issue adds a deep-link generator accessible from the invoice creation page and the dashboard that produces a shareable URL with query params encoding a pre-filled recipient address, asset, amount, and optional memo. Opening the link on StellarSplit auto-populates the /invoice/new form or the public pay page with those values.

Technical Context

Build components/ui/DeepLinkGenerator.tsx as a modal with fields for recipientAddress, asset, amount, and memo, generating a URL of the form /pay/new?to=[address]&asset=[code]&amount=[value]&memo=[text] using URLSearchParams. Apply Base64-URL encoding to protect memo text from special-character issues. In app/pay/new/page.tsx (new route), read these params via Next.js searchParams and pre-populate a simplified invoice creation form using defaultValues in react-hook-form. Validate each param server-side in the page's Server Component before passing to the client form (reject invalid G-addresses, non-positive amounts, unsupported asset codes). The generator modal includes a copy-to-clipboard button and a QR code of the generated URL rendered by the existing InvoiceQR infrastructure.

Acceptance Criteria

  • Opening a generated deep-link URL pre-populates the form with the correct recipient address, asset, amount, and memo without user intervention
  • Invalid params in the URL (e.g., malformed G-address, negative amount) are caught server-side and display an error page instead of a broken form
  • The copy-to-clipboard button copies the full URL and shows a transient "Copied!" confirmation
  • The QR code rendered in the modal encodes the generated URL and is scannable, navigating to the pre-filled form when scanned
  • Params that include special characters (ampersands, Unicode in memo) are correctly encoded and decoded without corruption
  • All CI checks (npm test, npm run build, ESLint/TypeScript) pass and the branch has no merge conflicts

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions