Generating SofizPay QR Codes
Learn how to construct and generate QR codes compatible with the SofizPay scanner for seamless in-app payments.
Public Key
Your unique merchant account identifier. This is the first and essential part of the data string.
Amount
The value of the transaction to be paid. It must be prefixed with &a=.
Memo (Data)
An optional description for the transaction, like an invoice or order ID. It must be prefixed with &dt=.
Generation Steps
Construct the Data String
The first step is to assemble your public key, the amount, and the memo in the required format.
// Format: publicKey&a=amount&dt=memo
// Example:
const publicKey = "YOUR_PUBLIC_KEY";
const amount = "2500.50"; // The amount to be paid
const memo = "Order-9876"; // An optional memo or invoice ID
const qrCodeString = `${publicKey}&a=${amount}&dt=${memo}`;
// Resulting string for the QR Code:
// "YOUR_PUBLIC_KEY&a=2500.50&dt=Order-9876"
Use a QR Code Generation Library
Use any standard QR code generation library to create the QR code from your constructed string.
// Example using the 'qrcode.react' library in a React project
// Installation: npm install qrcode.react
import { QRCodeSVG } from 'qrcode.react';
const qrString = "YOUR_PUBLIC_KEY&a=2500.50&dt=Order-9876";
function PaymentQRCode() {
return <QRCodeSVG value={qrString} size={256} />;
}
Display and Test the Code
Display the generated QR code in your application, then test it with the SofizPay QR Scanner to ensure data is read correctly.
// Ensure the QR code is clearly visible in your app's UI.
// Test with the SofizPay QR Scanner to verify that
// the amount and memo appear correctly before payment.Parameter Details
Parameter: publicKey (Required)
The merchant's unique public key. This must be the very first part of the string, with no prefix.
Parameter: &a= (Required)
The payment amount. Use a period (.) as the decimal separator. This field is mandatory for a valid payment.
Parameter: &dt= (Optional)
An optional memo or data like an order number. If it contains special characters, URL-encoding is recommended.