Overview
Payment QR codes encode payment request information that can be used to initiate transactions. They support both traditional bank transfers and cryptocurrency payments. When scanned, payment apps can auto-fill the recipient details and amount, streamlining the payment process.Data Structure
Payment QR codes use thePaymentQrData interface:
Payment method identifier. Use
"crypto" for cryptocurrency payments or any other identifier for traditional bank transfers.Name of the payment recipient or account holder.
Account number (for bank transfers) or cryptocurrency wallet address. For crypto, must be at least 26 characters. For bank transfers, must contain only digits, dashes, and spaces.
Bank name (for traditional transfers) or platform/cryptocurrency name (e.g., “Bitcoin”, “Ethereum”).
Payment amount. Must be greater than 0.
Optional payment reference, memo, or note (e.g., invoice number, order ID).
Encoding Format
The payment encoder (from/src/domain/encoders/encoders.ts:57-74) uses different formats for crypto vs traditional payments:
Cryptocurrency Format
For cryptocurrency payments (method: "crypto"):
Traditional Payment Format
For bank transfers (any method other than"crypto"):
Example Encodings
Cryptocurrency Payment
Cryptocurrency Payment
Input:Output:
Bank Transfer Payment
Bank Transfer Payment
Input:Output:
Validation Rules
The validator (from/src/domain/validation/validators.ts:131-168) enforces these requirements:
Required Fields
Required Fields
The following fields cannot be empty or whitespace only:
method- “El método de pago es obligatorio”name- “El nombre del destinatario es obligatorio”account- “La cuenta o dirección es obligatoria”bank- “El banco o plataforma es obligatorio”
Account Validation (Cryptocurrency)
Account Validation (Cryptocurrency)
For
method: "crypto":- Account (wallet address) must be at least 26 characters
- No format restrictions on characters
- Error: “Dirección de criptomoneda inválida (muy corta)”
Account Validation (Bank Transfer)
Account Validation (Bank Transfer)
For other methods (bank transfers):
- Must contain only digits, dashes, and spaces
- Regex pattern:
/^[\d\-\s]+$/ - Error: “Número de cuenta inválido (solo números, guiones y espacios)”
Amount Validation
Amount Validation
The
amount field must:- Be greater than 0
- Be a valid number (not NaN)
- Errors:
- “El monto debe ser mayor a 0”
- “El monto debe ser un número válido”
Reference Field
Reference Field
The
reference field is optional and has no specific validation rules.Validation Implementation
Usage Examples
Bank Transfer Payment
Cryptocurrency Payment
Common Use Cases
- Point of Sale: Generate payment QR codes at checkout
- Invoicing: Include payment QR codes on invoices
- Donations: Accept donations via bank transfer or cryptocurrency
- Bill Splitting: Share payment details for splitting bills
- Merchant Payments: Simplify customer payments at stores, restaurants, cafes
- P2P Transfers: Share account details for peer-to-peer payments
- Online Orders: Include in order confirmations for easy payment
Security Considerations
- Verify amounts: Always double-check the payment amount before generating the QR code
- Secure distribution: Only share payment QR codes through secure channels
- Time limits: Consider implementing expiration times for payment QR codes
- Confirmation: Users should verify recipient details before completing payment
- Cryptocurrency: For crypto payments, always verify the wallet address is correct
Supported Payment Methods
While themethod field accepts any string, common values include:
"crypto"- Cryptocurrency payments (triggers special encoding)"bank_transfer"- Traditional bank transfers"ach"- ACH transfers"wire"- Wire transfers"sepa"- SEPA transfers (Europe)- Custom values for region-specific payment methods
Only
"crypto" triggers the special cryptocurrency encoding format. All other method values use the standard bank transfer format.