Skip to content

xseman/bysquare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bysquare

"PAY by square" is a national standard for QR code payments that was adopted by the Slovak Banking Association in 2013. It is incorporated into a variety of invoices, reminders and other payment regulations.

Why

It's simple, I couldn't find any free implementation of "PAY by square" standard, so I decided to create one and share it with the community to help individuals and businesses to create QR codes for their invoices.

Features

  • Compatible with Slovak banking apps
  • Support latest PAY by square standard (v1.2.0)
  • Isomorphic Browser & Runtime-independent (Browser, Node.js, Bun, Deno)
  • Compatible with any system language using C Foreign Function Interface (CFFI)

Implementations

This repository provides multiple language implementations of the PAY by square standard:

  • TypeScript - Supports Browsers and any runtime Node.js, Bun, Deno
  • Go - Native Go implementation with CLI tool and C-compatible FFI

Both implementations are fully compatible with each other and follow the same specification.

---
config:
  theme: neutral
  themeVariables:
    fontFamily: monospace
    fontSize: "10px"
---

flowchart LR
    subgraph Core["Core Implementations"]
        TS[TypeScript]
        GO[Go]
    end

    subgraph Runtime["Runtime Environments"]
        TS --> Browser
        TS --> Node/Bun/Deno
    end

    TS & GO --> CLI[CLI encoder/decoder tools]

    subgraph Native["Go Library"]
        GO --> GO_LIB[Go Applications]
    end

    subgraph FFI["Universal via C FFI"]
        GO --> CFFI[libbysquare.so/dll]
        CFFI --> ANY[Python, PHP, Java, Swift, etc.]
    end

    style TS fill:#A5D8FF,stroke:#1976D2,stroke-width:1.5px
    style Browser fill:#A5D8FF,stroke:#1976D2,stroke-width:1.5px
    style Node/Bun/Deno fill:#A5D8FF,stroke:#1976D2,stroke-width:1.5px

    style GO fill:#A5EAFF,stroke:#00838F,stroke-width:1.5px
    style GO_LIB fill:#A5EAFF,stroke:#00838F,stroke-width:1.5px
    style CFFI fill:#A5EAFF,stroke:#00838F,stroke-width:1.5px
Loading

Using C FFI

The Go implementation provides a C-compatible Foreign Function Interface (FFI), allowing you to use the library from any language that supports C bindings.

Available examples:

  • Java - Using JNA (Java Native Access)
  • PHP - Using FFI extension
  • Python - Using ctypes
  • Swift - Using Swift's C interoperability

See FFI examples for setup and usage instructions.

Related