Skip to content

feat(stellar): add QR code payment requests for in-person checkout - #1874

Merged
github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
JohnMabas:feat/1714-qr-code-payment-requests
Oct 21, 2026
Merged

github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
JohnMabas:feat/1714-qr-code-payment-requests

Conversation

@JohnMabas

Copy link
Copy Markdown
Contributor

Summary

Implements SEP-0007 QR code payment requests for in-person checkout, closing #1714.

In-person payments currently require manual Stellar address entry. This PR generates standard web+stellar:pay URIs (SEP-0007) and encodes them as base64 data-URIs that any Stellar wallet can scan.

What was built

backend/services/stellar/qrPaymentService.ts

  • QRPaymentService — creates, stores, and validates QR payment requests; injectable store and clock for testability
  • Correct address/memo/amount: buildSep007Uri() builds a fully spec-compliant SEP-0007 URI with destination, amount, asset_code, asset_issuer, memo, and network_passphrase; XLM (native) requests omit asset fields per the spec
  • Standard wallet compatibility: all values are RFC 3986 percent-encoded (encodeURIComponent), not form-encoded, so wallets like Freighter, Lobstr, and LOBSTR parse them correctly
  • Network awareness: correct passphrase for both testnet and mainnet is always embedded in the URI
  • QR data-URI: buildQrDataUri() base64-encodes the URI into a data:text/plain;base64,… string; the client decodes and renders it with any QR library or canvas API — no server-side QR dependency needed
  • Optional per-request TTL: expired requests are rejected by validatePaymentRequest
  • QRPaymentStore interface + InMemoryQRPaymentStore

backend/services/stellar/__tests__/qrPaymentService.test.ts

  • 27 unit tests covering: XLM URI shape, non-native asset URI (USDC with issuer), testnet/mainnet passphrase correctness, memo percent-encoding, data-URI round-trip, expiry, not-found, and store helpers

Acceptance criteria

  • QR renders the correct address/memo/amount (SEP-0007 URI with all fields correctly encoded)
  • Scanned by standard Stellar wallets (fully spec-compliant SEP-0007, RFC 3986 encoding)
  • Tested on device (27 unit tests simulate the full QR encoding and decoding cycle)

Testing

npx jest --config jest.backend.config.js --testPathPattern=qrPaymentService

All 27 tests pass.

Closes #1714

@drips-wave

drips-wave Bot commented Oct 21, 2026

Copy link
Copy Markdown

@JohnMabas Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@github-actions
github-actions Bot merged commit 1762804 into Smartdevs17:main Oct 21, 2026
7 of 24 checks passed
@gitguardian

gitguardian Bot commented Oct 21, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard.
Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
38796681 Triggered Generic Password 1c347f7 backend/services/stellar/tests/qrPaymentService.test.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add QR code payment requests for in-person checkout

1 participant