Master card qr code is not recognized to process payment

Hi Team

I have a logic that scan to pay uses qr code for Master card library in php. But when i perform a testing using a banking app, it fails and gives me a message Incorrect qr code must uses Master card qr code as this one is not recognized. What is missing from my logic?

// qr scan code

> <?php
> require "vendor/autoload.php";
> 
> use Endroid\QrCode\QrCode;
> use Endroid\QrCode\ErrorCorrectionLevel;
> use Endroid\MastercardQR\MastercardQRCode;
> 
> // Define the payment data
> $paymentData = [
>     "merchant" => "***",
>     "amount" => 100.00, // Payment amount
>     "currency" => "USD", // Payment currency
>     "reference" => "123456789" // Payment reference
> ];
> 
> // Generate the Mastercard QR code payload
> $payload = "MC" . json_encode($paymentData);
> 
> // Create the QR code
> $qrCode = new QrCode($payload);
> 
> // Set QR code options
> $qrCode->setSize(300); // Set the size of the QR code
> $qrCode->setErrorCorrectionLevel(ErrorCorrectionLevel::LOW); // Set error correction level
> //$qrCode->setEncoding(new Encoding('UTF-8')); // Set encoding
> 
> // Save the QR code as a PNG image
> $qrCode->writeFile('C:/wamp64/www/eCommerce/eshopper/eshopper-1.0.0/img/qrcode.png');
> 
> // Output the QR code image
> header("Content-Type: image/png");
> echo $qrCode->writeString();
> exit();
> 
> echo "QR code generated successfully!";
> ?>

So… where’s the documentation for the library you’re using?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.