Search by

foldas / qrstart-php

lukio

QR Start PHP SDK

v2.3.0 2026-11-09 11:50 UTC

This package is auto-updated.

Last update: 2026-11-09 11:57:07 UTC


README

PHP client for qrstart.eu services.

Installation

Download by hand lib folder:

https://github.com/foldas/qrstart-php/archive/main.zip

By composer:

composer require foldas/qrstart-php

Usage

Request for QR Code:

$data = [
	'type' => 'bank',
	'amount' => 1000,
	'currency' => 'CZK',
	'date' => '20210101',
	'account' => '123456789/6666',
	'note' => 'QR Platba',
	'variable' => '2021',
	'size' => 150
];
$qrstart = new Qr\QrStart('your-api-key');
$response = $qrstart->qrCode($data);

Response for QR Code:

{
	"success": true,
	"url": "https://api.qrstart.eu/files/abcdefghijklmn.png"
}

Signed URL (API key is not part of the URL):

If you want to put the QR code directly into a public page or an e-mail (<img src="...">), use a signed URL. The URL contains only your KID (Key ID) and a HMAC-SHA256 signature of the parameters, never the API key. Nobody can change any parameter (amount, account, ...) or create a new request without your API key. KID is shown next to your API key in the dashboard my.qrstart.eu.

$data = [
	'amount' => 1000,
	'currency' => 'CZK',
	'account' => '123456789/6666',
	'variable' => '2021'
];
$qrstart = new Qr\QrStart('your-api-key', 30, 'your-kid');
$url = $qrstart->signedUrl($data);
echo '<img src="' . htmlspecialchars($url) . '" alt="QR code">';

signedUrl($params, $image = true, $expires = null) returns the URL as a string (or false if API key, KID or params are missing or $expires is invalid). With $image = true the URL returns the image itself, with false it returns the URL of the generated file as plain text. PDF parameters (file) are not supported.

For e-mails and web pages (<img src="..."> or a clickable link) always keep the default $image = true. With false the URL returns only the text address of a temporary file that is deleted after one hour. The image parameter is part of the signature, so it cannot be added to the URL afterwards.

$expires limits how long the URL works (Unix timestamp or DateTimeInterface). After that the API returns the error link expired. Without it the URL never expires. The expiration is part of the signature, so it cannot be changed. For e-mails choose enough time, the recipient may open the e-mail weeks later:

$url = $qrstart->signedUrl($data, true, new DateTime('+60 days'));

With $image = true (default) the image is generated and counted as a request on the first load. Repeated loads of the same URL within 24 hours are served from cache and are not counted, after 24 hours the next load is counted again. With $image = false every load is counted.

Request for QR Code added into PDF file:

$data = [
	'type' => 'bank',
	'amount' => 1000,
	'currency' => 'CZK',
	'date' => '20210101',
	'account' => '123456789/6666',
	'note' => 'QR Platba',
	'variable' => '2021',
	'size' => 100,
	'file' => '/var/www/your-site/file.pdf',
	'top' => 10,
	'right' => 10
];
$qrstart = new Qr\QrStart('your-api-key');
$response = $qrstart->qrCode($data);

Response for PDF file with QR Code:

{
	"success": true,
	"url": "https://api.qrstart.eu/files/abcdefghijklmn.pdf"
}

Download QR code (PNG) or PDF file from our storage to you. Generated files are deleted continuously.

Validation (no code generated, not billed):

validate($params) takes the same parameters as qrCode(). The API runs the same checks (account number / IBAN, suspended and allowed accounts, data too long for the QR code, uploaded PDF, credit) but generates nothing and bills nothing. Use it while developing your integration or to check payment details before generating. With file the PDF is uploaded (uploading is not billed) and checked as well.

$qrstart = new Qr\QrStart('your-api-key');
$response = $qrstart->validate($data);

Response for validation:

{
	"success": true,
	"validate": true,
	"points": 1,
	"data": {
		"bank": "CZ",
		"account": "19-2000145399/0800",
		"iban": "CZ6508000000192000145399",
		"amount": "1000.00",
		"currency": "CZK",
		"date": "20261109",
		"note": "Faktura 20210001",
		"variable": "20210001"
	},
	"output": {
		"format": "png",
		"size": 150,
		"margin": 2,
		"qr_version": 5,
		"error_correction": "L"
	}
}

data contains the fields exactly as they would be encoded (after normalization, e.g. a Czech account number converted to IBAN, for CZ the note without diacritics cut to 60 characters), points how many codes generating would bill (PDF = 2) and output the normalized output parameters. Errors are the same as for qrCode(). Validation does not check the monthly spending limit. A signed validation URL can be created with signedUrl(array_merge($data, ['validate' => 1]), false) – it returns JSON.

False response:

{
	"success": false,
	"message": "error message"
}

Input parameters

  • type - type of code

    • possible values are bank, ean13, code128, text (default bank)
  • type bank:

    • amount - the amount (int or float)
      • required
    • currency - CZK or EUR
      • required for CZ/SK bank
      • for SEPA bank, the currency is automatically EUR
    • bank - CZ or SK or SEPA
      • CZ for czech QR code, SK for slovak QR code (it means CZ for czech bank app, SK for slovak bank app)
      • SEPA means EPC SEPA format
      • if empty, CZ for CZK currency and SK for EUR currency will be used
    • account - whole account number include bank code (123-456789123/4567)
      • for CZK currency
    • iban - IBAN
      • required for EUR currency (or for CZK, if you don't want to fill account)
    • swift - SWIFT code (BIC)
    • variable - variable symbol
    • constant - constant symbol
    • specific - specific symbol
    • note - note for the payer
    • date - due date (format YYYYMMDD)
    • size - size of generated png image in pixels (min. 50, max. 600, default 150)
      • for pdf the size is the width in points (min. 50, max. 600, default 150)
    • margin - image margin in pixels (default 2)
    • tag - internal note (visible in the dashboard, max. 50 chars)
    • reference - payer reference
      • for SK bank EUR currency (variable and constant and specific must be empty)
      • for SEPA bank
    • beneficiary - beneficiary name (max. 70 chars)
      • required for SEPA bank
      • recommended for SK bank (required by PAY by square specification 1.2.0), longer text is cut to 70 chars
    • remittance - remittance text
      • for SEPA bank only (reference must be empty)
    • instant 0-1 (int) (default 0)
      • use 1 for instant payment
      • for CZ bank only
  • type ean13:

    • code - EAN-13 code
      • required
    • size - 1-5 (int) (default 2)
      • for pdf the size is the width in points (min. 50, max. 600, default 150)
    • tag - internal note (visible in the dashboard, max. 50 chars)
  • type code128:

    • code - some text
      • required
    • size - 1-5 (int) (default 2)
      • for pdf the size is the width in points (min. 50, max. 600, default 150)
    • tag - internal note (visible in the dashboard, max. 50 chars)
  • type text:

    • code - some text
      • required
    • size - size of generated png image in pixels (min. 50, max. 600, default 150)
      • for pdf the size is the width in points (min. 50, max. 600, default 150)
    • margin - image margin in pixels (default 2)
    • tag - internal note (visible in the dashboard, max. 50 chars)
  • if you want put QR Code to you pdf file, add following parameters

    • file - location of pdf file on server
    • top - position from top in points
    • bottom - position from bottom in points
      • in one request use top or bottom
    • left - position from left in points
    • right - position from right in points
      • in one request use left or right
    • page - the page on which the image is saved (default 1)
      • for last page use value -1
    • all sizes and positions in the PDF are in points (1 pt = 1/72 inch ≈ 0.35 mm, 10 mm ≈ 28 pt)
  • by default the QR code image is generated as PNG, but you can also generate it as JPG/WEBP

    • output - jpg or webp
      • jpg value creates an image in JPG format
      • webp value creates an image in WEBP format

Signature for other languages

The signature is HMAC-SHA256(query, api_key) as lowercase hex, where query is built from all request parameters except kid and signature, sorted by key and encoded like PHP http_build_query() (application/x-www-form-urlencoded, space as +). Then add kid and signature to the request. It works for GET and POST requests (and for upload.qrstart.eu) instead of apikey.

Help

Please check the examples folder.