ethqr-gen
A Rust library for generating EMVCo-compliant QR codes for payments according to the Ethiopian Interoperable QR Standard.
Features
- EMVCo QR Code standard compliance
- Support for multiple payment schemes (Visa, Mastercard, IPS ET, etc.)
- Static and dynamic QR code generation
- Built-in validation and error handling
- QR code image generation** (enable with
qr-imagefeature)
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
# For QR code image generation
= { = "0.1.0", = ["qr-image"] }
Quick Start
Static QR Code (no amount specified)
use ;
let qr_code = new
.merchant_name
.merchant_city
.merchant_category_code // Restaurant
.add_scheme
.build?;
Dynamic QR Code (with specific amount)
use ;
let additional_data = new
.bill_number
.reference_label;
let qr_code = new
.merchant_name
.merchant_city
.merchant_category_code
.add_scheme
.transaction_amount
.additional_data
.build?;
Multiple Payment Schemes
let qr_code = new
.merchant_name
.merchant_city
.merchant_category_code // Grocery store
.add_scheme
.add_scheme
.add_scheme
.build?;
Supported Payment Schemes
| Scheme | Method | Description |
|---|---|---|
| Visa | SchemeConfig::visa() |
Visa payment cards |
| Mastercard | SchemeConfig::mastercard() |
Mastercard payment cards |
| UnionPay | SchemeConfig::unionpay() |
UnionPay payment cards |
| IPS ET | SchemeConfig::ips_et() |
Ethiopian Interbank Payment System |
Standards Compliance
This library implements:
- EMVCo QR Code Specification for Payment Systems
- Ethiopian Interoperable QR Standard
- ISO 4217 currency codes (ETB - Ethiopian Birr)
- ISO 3166-1 country codes (ET - Ethiopia)
Examples
Check out the examples/ directory for more comprehensive usage examples:
Contributing
Contributions are always welcome!