Download the PHP package kenlas/mnb-qr-code-payment-generator-php without Composer
On this page you can find all versions of the php package kenlas/mnb-qr-code-payment-generator-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package mnb-qr-code-payment-generator-php
mnb-qr-code-payment-generator-php
PHP implementation of MNB's (Hungarian National Bank) QR code payment generation algorithm
The complete guide can be found here: https://www.mnb.hu/letoltes/qr-kod-utmutato-20190712.pdf
Uses endroid/qr-code for QR code image generation.
Requirements
PHP 7.2
Installation
Example usage
You can send the generated QR code directly to the output:
You can save it as an image:
Or you can get the QR code as base64 encoded data URI:
You can also use your own QR code renderer: (see https://github.com/endroid/qr-code for more examples)
MnbQrCodePayment\Generator available setters
| Method name | Required/optional | Maximum length | Description |
|---|---|---|---|
| setMethod($code) | Required | 3 | Must be HCT for transfer orders or RTP for payment request |
| setVersion($version) | Optional | 3 | For future use only, defaults to 001 |
| setCharacterSet($charset) | Optional | 1 | For compatibility reasons only, defaults to 1 |
| setBic($bic) | Required | 11 | The bank's BIC/SWIFT code |
| setName($name) | Required | 70 | The payer/beneficiary name |
| setIban($iban) | Required | 28 | The payer/beneficiary IBAN account number |
| setAmount($amount) | Optional | 12 | The payment amount in HUF, integers only |
| setExpiration($date) | Required | - | PHP Date object for the expiration date |
| setPaymentSituation($purposeCode) | Optional | 4 | Purpose code for the given payment situation (see https://www.iso20022.org/catalogue-messages/additional-content-messages/external-code-sets) |
| setMessage($message) | Optional | 70 | Message |
| setShopId($value) | Optional | 35 | Shop ID |
| setDeviceId($value) | Optional | 35 | Device ID |
| setInvoiceId($value) | Optional | 35 | Invoice ID |
| setCustomerId($value) | Optional | 35 | Customer ID |
| setTransactionId($value) | Optional | 35 | Transaction ID |
| setLoyaltyId($value) | Optional | 35 | Loyalty ID |
| setNavVerificationCode($value) | Optional | 35 | NAV verification code |
MnbQrCodePayment\Utils available helper methods
| Method name | Description |
|---|---|
| hungarianBbanToIban($bban) | Convert a hungarian BBAN (16 or 24 character lengths) to IBAN format |
MnbQrCodePayment\QrCodeImage available methods
| Method name | Description |
|---|---|
| constructor | Optionally initialize with a QR code string, generated by MnbQrCodePayment\Generator |
| setQrString($qrString) | QR code string generated by MnbQrCodePayment\Generator |
| setRenderer($renderer) | Set a new renderer - an instance of Endroid\QrCode\QrCode. Can be useful if you want to customize QR code's settings |
| display() | Send appropriate headers and display QR code as an image (PNG format by default) |
| saveTo($path) | Save QR code as an image file (PNG format by default) |
| asDataUri() | Returns the QR code as a base64 encoded data URI - useful to pass to an img src attribute |
Contact
If you have any questions feel free to contact me at [email protected]