I am developing my own plugin that handles PDF generating (invoices, pro-formas etc.). I would like to include QR code that if user scans in the Bank app it will set the payment data for them (name, IBAN, variable symbol, amount for pay etc.).
I am using TCPDF to generate QR code, but content of the QR code needs to be set to specific string (probably hashed data with payment information).
So that brings me to my question, is there a way how I can generate this code that will be output in form of QR code so customers can open their bank APP and scan it to automatically set the payment data? Using PHP in Wordpress site.
I am new to this topic so I am trying to find out if this stuff is even possible.
// Create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// Set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Your Name');
$pdf->SetTitle('Scan and Pay QR Code Example');
// Add a page
$pdf->AddPage();
// Set QR code style
$style = array(
'border' => 2,
'vpadding' => 'auto',
'hpadding' => 'auto',
'fgcolor' => array(0,0,0),
'bgcolor' => false, // No background color
'module_width' => 1, // Width of a single module in points
'module_height' => 1 // Height of a single module in points
);
// Define the content of the QR code that includes a variable symbol and an amount
$variableSymbol = "1111";
$amount = "1 EUR";
$merchantCode = "123456789012";
$transactionCurrency = "978"; // EUR's numeric code
// This is the string that should be formatted in a way that bank apps can read it. HERE IS THE PROBLEM
$codeContents = "TXN:".$variableSymbol."-AMT:".$amount."-MCC:".$merchantCode."-CUR:".$transactionCurrency;
// Print a QR code
$pdf->write2DBarcode($codeContents, 'QRCODE,H', 20, 20, 50, 50, $style, 'N');
// Close and output PDF document
$pdf->Output('scan_and_pay_qr.pdf', 'D');
I tried to include the data according to some ducomentation online (SEPA, EMVCo) but I did not managed to make it work. It shows invalid QR code data in my bank app.