Closed zemnet closed 6 years ago
For Slovak banks it's pretty much the same, but if I recall correctly they don't use BBAN format anymore, so you must initiate the class by IBAN and change currency and country:
<?php
use rikudou\CzQrPayment\QrPayment;
$payment = QrPayment::fromIBAN("SK0809000000000123123123")
->setCountry("SK")
->setCurrency("EUR");
$payment->setAmount(100); // set amount to 100 EUR
echo $payment->getQrString(); // returns the string to be encoded in QR code
// if you use endroid/qrcode 1.6:
$payment->getQrImage(true) // renders the image and sets content-type
->setSize(300) // to image/png
->render();
So pretty much the only thing that changes is how you initiate the class.
You can also use the old format that banks don't support anymore:
<?php
use rikudou\CzQrPayment\QrPayment;
$payment = (new QrPayment("0123123123", "0900"))
->setCountry("SK")
->setCurrency("EUR");
This code provides the same result as in previous comment.
Another way is to extend the class, something like this:
<?php
use rikudou\CzQrPayment\QrPayment;
class SKPayment extends QrPayment {
public function __construct($iban, $options = null) {
parent::__construct(0, 0, $options);
$this->iban = $iban;
$this->setCountry("SK");
$this->setCurrency("EUR");
}
}
Yes, I test it on my webapp with this config, but mobile app for Tatrabanka and VUB return error "wrong format" ...
$payment = QrPayment::fromIBAN("SK........")->setOptions([
QrPaymentOptions::AMOUNT => 100,
QrPaymentOptions::VARIABLE_SYMBOL => 1502,
QrPaymentOptions::CONSTANT_SYMBOL => '0308',
QrPaymentOptions::CURRENCY => "EUR",
QrPaymentOptions::COUNTRY => "SK",
QrPaymentOptions::DUE_DATE => date("Y-m-d", strtotime("+14 days"))
]);
$payment->getQrImage(true)
->render();
Slovak banks use entirely different format called "PAY by square". Since I don't have a Slovak account, I cannot implement PAY by square.
@zemnet Well, here you go.
@RikudouSage Hey man, you are hero :) I test it at tomorrow. Thank you
Hi, what must we do to allow works with Slovak banks?
Thank you