EPC QR Code
- 6 minutes to read
An EPC QR Code (European Payments Council Quick Response Code) is a two-dimensional barcode used to initiate a SEPA credit transfer (SCT). The following guideline contains general information about this type of barcode and defines the data format for EPC QR Codes: Quick Response Code - Guidelines to Enable the Data Capture for the Initiation of a SEPA Credit Transfer.
Add a Bar Code to a Report
Drag the XRBarCode item from the DX.24.2: Report Controls tab and drop it onto the report.
Set the XRBarCode control’s Symbology property to QRCodeEPC (an object of the QRCodeEPCGenerator type).
Specify common barcode properties and properties specific to EPC QR Codes.
Specific Properties
- AutoModule
- Gets or sets whether the Module property value should be calculated automatically based on the barcode size.
- Version
- Gets or sets the barcode’s version.
- IncludeQuietZone
- Gets or sets whether to add a blank space around the QR code.
- Logo
- Specifies the image that overlays the QR code.
- FrameOptions
- Gets or sets the frame for QR codes.
Specify the Data
EPC QR Codes require data in a specific format. For more information, refer to the following European Payments Council guideline: Quick Response Code - Guidelines to Enable the Data Capture for the Initiation of a SEPA Credit Transfer.
You can specify the barcode data in the following ways:
Design Time
- The Text property.
Pass the data string to Text property. Each data element should be on a new line. Double-click the control to specify the content (editors in the Property grid do not support multi-line text):
In the image above, the following data elements are specified:
Data Element Value Service Tag: BCD Version: 001 Encoding: 1 Identification: SCT BIC: BPOTBEB1 Beneficiary Name: Red Cross of Belgium IBAN: BE72000000001616 Transfer Amount: EUR1 Transfer Reason: CHAR Creditor Reference: Empty line Remittance Information: Urgency fund Information: Empty line This field is bindable. For more information on data binding, review the following help topic: Bind Report Controls to Data Using Expression Bindings.
- The ConvertDataToEPC function.
Use the
ConvertDataToEPC
function from the Expression Editor to bind to theText
property.You can specify the data as shown below:
ConvertDataToEPC('Red Cross of Belgium', 'BE72000000001616', 'BPOTBEB1','20.0', '', 'Urgency fund', 'CHAR', 'Sample EPC QR code')
You can not change the default values for Version and Encoding with this function. The default value for the Version data element is
002
andUTF-8
for the Encoding.
Runtime
- The Text property.
Pass the data string to Text property. Data elements should be separated by carriage return or line feed characters.
- The BinaryData property.
- Pass the binary data to BinaryData property.
- The EPCDataConverter class.
Create an instance of the EPCDataConverter class to convert separate data elements to a format required for EPC QR Codes.
The following code snippets transforms the data elements into a formatted string and passes it to the barcode’s Text property:
using DevExpress.XtraPrinting.BarCode; using DevExpress.XtraPrinting.BarCode.EPC; using DevExpress.XtraReports.UI; //... XRBarCode barCode = new XRBarCode(); barCode.Symbology = new QRCodeEPCGenerator(); //... var epcData = new EPCDataConverter() { Version = EPCVersion.Version1; BIC = "BPOTBEB1", BeneficiaryName = "Red Cross of Belgium", IBAN = "BE72000000001616", TransferAmount = 20, TransferPurpose = "CHAR", RemittanceInformation = "Urgency Fund", Information = "Sample EPC QR code" }; barCode.Text = epcData.StringData; // ...
You can also pass the barcode data to the barcode’s BinaryData property. Do this use the BinaryData property of the EPCDataConverter class instance:
Display a “Zahlen mit Code” Frame
You can also apply a frame with the words “Zahlen mit Code” (to the right from the bottom to the top) to an EPC QR Code. The frame is used to highlight the function of the codes and to secure the identification. For more information, refer to the following Payment Services Austria (PSA) document: Application of QR-Code for initiating of credit transfers.
This frame already contains predefined settings according to the standard. To set this frame at design time, go to Behavior → Symbology → FrameOptions, and select PaymentServicesAustriaQRFrameOptions.
To set this frame in code, assign a new instance of PaymentServicesAustriaQRFrameOptions
to the QRCodeGenerator.FrameOptions property.
((QRCodeGenerator)barCode.Symbology).FrameOptions = new PaymentServicesAustriaQRFrameOptions();
Runtime Example
The following code creates an EPC QR Code barcode and specifies its properties:
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Windows.Forms;
using DevExpress.XtraPrinting.BarCode;
using DevExpress.XtraPrinting.BarCode.EPC;
using DevExpress.XtraReports.UI;
// ...
public XRBarCode CreateQRCodeEPCBarCode() {
// Create a barcode control.
XRBarCode barCode = new XRBarCode();
// Set the barcode's type to QRCode.
barCode.Symbology = new QRCodeEPCGenerator();
// Adjust the barcode's main properties.
barCode.Width = 400;
barCode.Height = 400;
var epcData = new EPCDataConverter() {
BIC = "BPOTBEB1",
BeneficiaryName = "Red Cross of Belgium",
IBAN = "BE72000000001616",
TransferAmount = 20,
RemittanceInformation = "Urgency Fund"
};
barCode.Text = epcData.StringData;
return barCode;
}
The code example below shows how to create a report with an EPC QR Code barcode: