ethqr-gen 0.1.0

Ethiopian QR Code Payment Generator - EMVCo compliant QR codes for IPS ET
Documentation

ethqr-gen

CI Crates.io Documentation Downloads License: MIT OR Apache-2.0 Rust Version

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-image feature)

Installation

Add this to your Cargo.toml:

[dependencies]
ethqr-gen = "0.1.0"

# For QR code image generation
ethqr-gen = { version = "0.1.0", features = ["qr-image"] }

Quick Start

Static QR Code (no amount specified)

use ethqr_gen::{QRBuilder, fields::SchemeConfig};

let qr_code = QRBuilder::new()
    .merchant_name("Coffee Shop")
    .merchant_city("Addis Ababa")
    .merchant_category_code("5812") // Restaurant
    .add_scheme(SchemeConfig::visa("4111111111111111"))
    .build()?;

Dynamic QR Code (with specific amount)

use ethqr_gen::{QRBuilder, fields::{SchemeConfig, AdditionalData}};

let additional_data = AdditionalData::new()
    .bill_number("INV-001")
    .reference_label("ORDER-123");

let qr_code = QRBuilder::new()
    .merchant_name("Restaurant")
    .merchant_city("Dire Dawa")
    .merchant_category_code("5812")
    .add_scheme(SchemeConfig::ips_et(
        "581b314e257f41bfbbdc6384daa31d16",
        "CBETETAA",
        "10000171234567890",
    ))
    .transaction_amount("420.00")
    .additional_data(additional_data)
    .build()?;

Multiple Payment Schemes

let qr_code = QRBuilder::new()
    .merchant_name("Supermarket")
    .merchant_city("Bahir Dar")
    .merchant_category_code("5411") // Grocery store
    .add_scheme(SchemeConfig::visa("4111111111111111"))
    .add_scheme(SchemeConfig::mastercard("5555555555554444"))
    .add_scheme(SchemeConfig::ips_et(
        "899c314e257f41bfbbdc6384dab49e15",
        "CBETETAA",
        "10000171234567890",
    ))
    .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!

License