View Source QRNBUEx (NBU payment QR v0.3.3)

Documentation for QRNBUEx.

amount = Decimal.new("10.20")

data = %QRNBU{
  recipient: "Негрієнко Данило Олександрович",
  tax_id: "1246993119",
  iban: "UA303348510000026206114040874",
  amount: amount,
  purpose: "Призначення платежу"
}

# Generate data string for QR encoding
{:ok, qr_data} = QRNBUEx.generate(data)

# Use any QR code library to render the image
# For example with qr_code library:
# qr_data |> QRCode.create() |> QRCode.render() |> QRCode.save("qr.svg")

Summary

Functions

Generate NBU QR code data string from %QRNBU{} struct.

Functions

Link to this function

generate(data, options \\ [])

View Source
@spec generate(
  map(),
  keyword()
) :: {:ok, binary()} | {:error, binary()}

Generate NBU QR code data string from %QRNBU{} struct.

Returns the formatted data string ready to be encoded into a QR code image using any QR code rendering library.

Options

  • :encoding - :utf8 (default) or :cp1251

Examples

iex> data = %QRNBU{recipient: "Test", iban: "UA...", ...}
iex> {:ok, qr_string} = QRNBUEx.generate(data)
iex> # Now use qr_string with any QR rendering library