This library is a port of the steplix/emv-qrcps library library which is a fork of Emmanuel Kiametis library to the .NET platform. Basically the implementation is the same, so the tutorial below has been copied and adapted for use in C#.
This library was made to help people that to generate and parse EMV QRcode according with the specifications:
- Merchant Specification
- Consumer Specification
There are 2 modules in this library.
- Merchant - To work with QRCode according with the
Merchant Specification
. - Consumer - To work with QRCode according with the
Consumer Specification
.
You can use this Module by importing:
using emv_qrcps.QrCode.Merchant;
TLV tlv = new TLV(tag, length, value);
Parameter | Description | Type |
---|---|---|
tag |
Payload Format Indicator | string |
length |
Point of Initiation Method | int |
value |
Merchant Account Information | string |
| TLV
| It means an object that stores a Tag + Lenght + Value. |
MerchantEMVQR emvqr = new MerchantEMVQR();
// ... OR
MerchantEMVQR emvq = new MerchantEMVQR()
(
payloadFormatIndicator,
pointOfInitiationMethod,
merchantAccountInformation,
merchantCategoryCode,
transactionCurrency,
transactionAmount,
tipOrConvenienceIndicator,
valueOfConvenienceFeeFixed,
valueOfConvenienceFeePercentage,
countryCode,
merchantName,
merchantCity,
postalCode,
additionalDataFieldTemplate,
crc,
merchantInformationLanguageTemplate,
rfuForEMVCo,
unreservedTemplates,
);
Parameter | Description | Type |
---|---|---|
payloadFormatIndicator |
Payload Format Indicator | TLV |
pointOfInitiationMethod |
Point of Initiation Method | TLV |
merchantAccountInformation |
Merchant Account Information | Dictionary<string, MerchantAccountInformation> |
merchantCategoryCode |
Merchant Category Code | TLV |
transactionCurrency |
Transaction Currency | TLV |
transactionAmount |
Transaction Amount | TLV |
tipOrConvenienceIndicator |
Tip or Convenience Indicator | TLV |
valueOfConvenienceFeeFixed |
Value of Convenience Fee Fixed | TLV |
valueOfConvenienceFeePercentage |
Value of Convenience Fee Percentage | TLV |
countryCode |
Country Code | TLV |
merchantName |
Merchant Name | TLV |
merchantCity |
Merchant City | TLV |
postalCode |
Postal Code | TLV |
additionalDataFieldTemplate |
Additional Data Field Template | AdditionalDataFieldTemplate |
crc |
CRC | TLV |
merchantInformationLanguageTemplate |
Merchant Information - Language Template | MerchantInformationLanguageTemplate |
rfuForEMVCo |
RFU for EMVCo | TLV[] |
unreservedTemplates |
Unreserved Templates | Dictionary<string, UnreservedTemplate> |
Return Type | Description |
---|---|
MerchantEMVQR |
It means an object that represents an EMV QRCode. |
AdditionalDataFieldTemplate additionalDataFieldTemplate = new AdditionalDataFieldTemplate();
// ... OR
AdditionalDataFieldTemplate additionalDataFieldTemplate = new AdditionalDataFieldTemplate
(
billNumber,
mobileNumber,
storeLabel,
loyaltyNumber,
referenceLabel,
customerLabel,
terminalLabel,
purposeTransaction,
additionalConsumerDataRequest,
rfuForEMVCo,
paymentSystemSpecific
);
Parameter | Description | Type |
---|---|---|
billNumber |
Bill Number | TLV |
mobileNumber |
Country Code | TLV |
storeLabel |
Store Label | TLV |
loyaltyNumber |
Loyalty Number | TLV |
referenceLabel |
Reference Label | TLV |
customerLabel |
Customer Label | TLV |
terminalLabel |
Terminal Label | TLV |
purposeTransaction |
Purpose of Transaction | TLV |
additionalConsumerDataRequest |
Additional Consumer Data Request | TLV |
rfuForEMVCo |
RFU for EMVCo | TLV[] |
paymentSystemSpecific |
Payment System specific templates | Dictionary<string, PaymentSystemSpecific> |
Return Type | Description |
---|---|
AdditionalDataFieldTemplate |
It means an object that represents an additional data field template. |
MerchantInformationLanguageTemplate merchantInformationLanguageTemplate = new MerchantInformationLanguageTemplate();
// ... OR
MerchantInformationLanguageTemplate merchantInformationLanguageTemplate = new MerchantInformationLanguageTemplate
(
languagePreference,
merchantName,
merchantCity,
rfuForEMVCo,
);
Parameter | Description | Type |
---|---|---|
languagePreference |
Language Preference | TLV |
merchantName |
Name of the merchant | TLV |
merchantCity |
Name of the marchant city | TLV |
rfuForEMVCo |
RFU for EMVCo | TLV[] |
Return Type | Description |
---|---|
MerchantInformationLanguageTemplate |
It means an object that represents a merchant information language template. |
MerchantAccountInformation merchantAccountInformation = new MerchantAccountInformation();
// ... OR
MerchantAccountInformation merchantAccountInformation = new MerchantAccountInformation(
globallyUniqueIdentifier,
paymentNetworkSpecific,
);
Parameter | Description | Type |
---|---|---|
globallyUniqueIdentifier |
Globally unique identifier | TLV |
paymentNetworkSpecific |
Array of payment network specific | TLV[] |
Return Type | Description |
---|---|
MerchantAccountInformation |
It means an object that represents a merchant account information. |
UnreservedTemplate unreservedTemplate = new UnreservedTemplate();
// ... OR
UnreservedTemplate unreservedTemplate = new UnreservedTemplate
(
globallyUniqueIdentifier,
paymentNetworkSpecific,
);
Parameter | Description | Type |
---|---|---|
globallyUniqueIdentifier |
Globally unique identifier | TLV |
contextSpecificData |
Array of context of specific data | TLV[] |
Return Type | Description |
---|---|
UnreservedTemplate |
It means an object that represents an unreserved template. |
Represents a TAG + Length + Value.
using emv_qrcps.QrCode.Merchant;
string tag = "01";
string value = "Example";
int length = value.Length;
TLV tlv = new TLV(tag, length, value);
string tlvStringFormat = TLV.ToString();
Return Type | Description |
---|---|
string |
TLV in string format |
string tlvBinaryFormat = TLV.DataWithType(MerchantConsts.DATA_TYPE.BINARY, ' '); // Binary Data (shown as hex bytes)
// OR
string tlvRawFormat = TLV.DataWithType(MerchantConsts.DATA_TYPE.RAW, ' '); // Raw Data
Parameters | Description | Type |
---|---|---|
dataType |
Data type value | MerchantConsts.DATA_TYPE.BINARY | MerchantConsts.DATA_TYPE.RAW |
indent |
Indent character (Ex.: ' ') | string |
Return Type | Description |
---|---|
string |
TLV in binary OR raw data format |
Represents a merchant account information.
using emv_qrcps.QrCode.Merchant;
MerchantAccountInformation merchantAccountInformation = new MerchantAccountInformation();
string merchantAccountInformationStringFormat = merchantAccountInformation.ToString();
Return Type | Description |
---|---|
string |
MerchantAccountInformation in TLV string format |
string merchantAccountInformationBinaryFormat = merchantAccountInformation.DataWithType(MerchantConsts.DATA_TYPE.BINARY, ' '); // Binary Data (shown as hex bytes)
// OR
string merchantAccountInformationRawFormat = merchantAccountInformation.DataWithType(MerchantConsts.DATA_TYPE.RAW, ' '); // Raw Data
Parameters | Description | Type |
---|---|---|
dataType |
Data type value | MerchantConsts.DATA_TYPE.BINARY | MerchantConsts.DATA_TYPE.RAW |
indent |
Indent character (Ex.: ' ') | string |
Return Type | Description |
---|---|
string |
MerchantAccountInformation in TLV binary OR TLV raw data format |
string value = "15600000000";
merchantAccountInformation.SetGloballyUniqueIdentifier(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string id = "03";
string value = "12345678";
//merchantAccountInformation.AddPaymentNetworkSpecific(id, value);
merchantAccountInformation.AddContextSpecificData(id, value);
Parameters | Description | Type |
---|---|---|
id |
Tag ID | string |
value |
Some value | string |
Represents a merchant information language template.
using emv_qrcps.QrCode.Merchant;
MerchantInformationLanguageTemplate merchantInformationLanguageTemplate = new MerchantInformationLanguageTemplate();
string merchantInformationLanguageTemplateStringFormat = merchantInformationLanguageTemplate.ToString();
Return Type | Description |
---|---|
string |
MerchantInformationLanguageTemplate in TLV string format |
string merchantInformationLanguageTemplateBinaryFormat = merchantInformationLanguageTemplate.DataWithType(MerchantConsts.DATA_TYPE.BINARY, ' '); // Binary Data (shown as hex bytes)
// OR
string merchantInformationLanguageTemplateRawFormat = merchantInformationLanguageTemplate.DataWithType(MerchantConsts.DATA_TYPE.RAW, ' '); // Raw Data
Parameters | Description | Type |
---|---|---|
dataType |
Data type value | MerchantConsts.DATA_TYPE.BINARY | MerchantConsts.DATA_TYPE.RAW |
indent |
Indent character (Ex.: ' ') | string |
Return Type | Description |
---|---|
string |
MerchantInformationLanguageTemplate in TLV binary OR TLV raw data format |
bool isValid = merchantInformationLanguageTemplate.Validate();
Return Type | Description |
---|---|
boolean |
True if required properties is valid otherwise throw an Error |
string value = "PT";
merchantInformationLanguageTemplate.SetLanguagePreference(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "Merchant Organization";
merchantInformationLanguageTemplate.SetMerchantName(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "Brasilia";
merchantInformationLanguageTemplate.SetMerchantCity(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string id = "03";
string value = "12345678";
merchantInformationLanguageTemplate.AddRFUforEMVCo(id, value);
Parameters | Description | Type |
---|---|---|
id |
Tag ID | string |
value |
Some value | string |
Represents a merchant account information.
using emv_qrcps.QrCode.Merchant;
UnreservedTemplate unreservedTemplate = new UnreservedTemplate();
string unreservedTemplateStringFormat = unreservedTemplate.ToString();
Return Type | Description |
---|---|
string |
UnreservedTemplate in TLV string format |
string unreservedTemplateBinaryFormat = unreservedTemplate.DataWithType(MerchantConsts.DATA_TYPE.BINARY, ' '); // Binary Data (shown as hex bytes)
// OR
string unreservedTemplateRawFormat = unreservedTemplate.DataWithType(MerchantConsts.DATA_TYPE.RAW, ' '); // Raw Data
Parameters | Description | Type |
---|---|---|
dataType |
Data type value | MerchantConsts.DATA_TYPE.BINARY | MerchantConsts.DATA_TYPE.RAW |
indent |
Indent character (Ex.: ' ') | string |
Return Type | Description |
---|---|
string |
UnreservedTemplate in TLV binary OR TLV raw data format |
string value = "15600000000";
unreservedTemplate.SetGloballyUniqueIdentifier(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
const id = "03";
const value = "12345678";
unreservedTemplate.AddContextSpecificData(id, value);
Parameters | Description | Type |
---|---|---|
id |
Tag ID | string |
value |
Some value | string |
Represents a payment system specific.
using emv_qrcps.QrCode.Merchant;
PaymentSystemSpecific paymentSystemSpecific = new PaymentSystemSpecific();
string paymentSystemSpecificStringFormat = paymentSystemSpecific.ToString();
Return Type | Description |
---|---|
string |
PaymentSystemSpecific in TLV string format |
string paymentSystemSpecificBinaryFormat = paymentSystemSpecific.DataWithType(MerchantConsts.DATA_TYPE.BINARY, ' '); // Binary Data (shown as hex bytes)
// OR
string paymentSystemSpecificRawFormat = paymentSystemSpecific.DataWithType(MerchantConsts.DATA_TYPE.RAW, ' '); // Raw Data
Parameters | Description | Type |
---|---|---|
dataType |
Data type value | MerchantConsts.DATA_TYPE.BINARY | MerchantConsts.DATA_TYPE.RAW |
indent |
Indent character (Ex.: ' ') | string |
Return Type | Description |
---|---|
string |
PaymentSystemSpecific in TLV binary OR TLV raw data format |
string value = "15600000000";
paymentSystemSpecific.SetGloballyUniqueIdentifier(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string id = "03";
string value = "12345678";
paymentSystemSpecific.AddContextSpecificData(id, value);
Parameters | Description | Type |
---|---|---|
id |
Tag ID | string |
value |
Some value | string |
Represents an additional data field template.
using emv_qrcps.QrCode.Merchant;
AdditionalDataFieldTemplate additionalDataFieldTemplate = new AdditionalDataFieldTemplate();
string additionalDataFieldTemplateStringFormat = additionalDataFieldTemplate.ToString();
Return Type | Description |
---|---|
string |
AdditionalDataFieldTemplate in TLV string format |
string additionalDataFieldTemplateBinaryFormat = additionalDataFieldTemplate.DataWithType(MerchantConsts.DATA_TYPE.BINARY, ' '); // Binary Data (shown as hex bytes)
// OR
string additionalDataFieldTemplateRawFormat = additionalDataFieldTemplate.DataWithType(MerchantConsts.DATA_TYPE.RAW, ' '); // Raw Data
Parameters | Description | Type |
---|---|---|
dataType |
Data type value | MerchantConsts.DATA_TYPE.BINARY | MerchantConsts.DATA_TYPE.RAW |
indent |
Indent character (Ex.: ' ') | string |
Return Type | Description |
---|---|
string |
AdditionalDataFieldTemplate in TLV binary OR TLV raw data format |
string value = "34250";
additionalDataFieldTemplate.SetBillNumber(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "+5561991112222";
additionalDataFieldTemplate.SetMobileNumber(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "1234";
additionalDataFieldTemplate.SetStoreLabel(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "12345";
additionalDataFieldTemplate.SetLoyaltyNumber(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "example";
additionalDataFieldTemplate.SetReferenceLabel(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "***";
additionalDataFieldTemplate.SetCustomerLabel(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "A6008667";
additionalDataFieldTemplate.SetTerminalLabel(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "Some purpose";
additionalDataFieldTemplate.SetPurposeTransaction(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "ME";
additionalDataFieldTemplate.SetAdditionalConsumerDataRequest(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string id = "03";
string value = "12345678";
additionalDataFieldTemplate.AddRFUforEMVCo(id, value);
Parameters | Description | Type |
---|---|---|
id |
Tag ID | string |
value |
Some value | string |
string id = "03";
string value = new PaymentSystemSpecific();
value.SetGloballyUniqueIdentifier("15600000000");
value.AddPaymentSystemSpecific("03", "12345678");
additionalDataFieldTemplate.AddContextSpecificData(id, value);
Parameters | Description | Type |
---|---|---|
id |
Tag ID | string |
value |
Some value | string |
Represents an EMV QRCode.
using emv_qrcps.QrCode.Merchant;
string emvqr = new MerchantEMVQR();
string emvqrStringFormat = emvqr.GeneratePayload();
Return Type | Description |
---|---|
string |
EMV QRCode payload in string format. |
string emvqrBinaryFormat = emvqr.DataWithType(MerchantConsts.DATA_TYPE.BINARY, ' '); // Binary Data (shown as hex bytes)
// OR
string emvqrRawFormat = emvqr.DataWithType(MerchantConsts.DATA_TYPE.RAW, ' '); // Raw Data
Parameters | Description | Type |
---|---|---|
dataType |
Data type value | MerchantConsts.DATA_TYPE.BINARY | MerchantConsts.DATA_TYPE.RAW |
indent |
Indent character (Ex.: ' ') | string |
Return Type | Description |
---|---|
string |
EMV QRCode in binary OR raw data format |
string emvqrBinaryFormat = emvqr.ToBinary(); // Binary Data (shown as hex bytes)
Return Type | Description |
---|---|
string |
EMV QRCode in binary format |
string emvqrBinaryFormat = emvqr.RawData(); // Raw Data
Return Type | Description |
---|---|
string |
EMV QRCode in raw data format |
bool isValid = emvqr.Validate();
Return Type | Description |
---|---|
boolean |
True if required properties is valid otherwise throw an Error |
string value = "01";
emvqr.SetPayloadFormatIndicator(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "00";
emvqr.setPointOfInitiationMethod(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "Technology";
emvqr.setMerchantCategoryCode(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "BRL";
emvqr.SetTransactionCurrency(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "20.5";
emvqr.SetTransactionAmount(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "2";
emvqr.SetTipOrConvenienceIndicator(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "2.00";
emvqr.SetValueOfConvenienceFeeFixed(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "0.90";
emvqr.SetValueOfConvenienceFeePercentage(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "55";
emvqr.SetCountryCode(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "Merchant Organization";
emvqr.SetMerchantName(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "Brasilia";
emvqr.SetMerchantCity(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "71715-000";
emvqr.SetPostalCode(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
string value = "AF35";
emvqr.SetCRC(value);
Parameters | Description | Type |
---|---|---|
value |
Some value | string |
AdditionalDataFieldTemplate additionalDataFieldTemplate = new AdditionalDataFieldTemplate();
additionalDataFieldTemplate.SetStoreLabel("1234");
additionalDataFieldTemplate.SetCustomerLabel("***");
additionalDataFieldTemplate.SetTerminalLabel("A6008667");
additionalDataFieldTemplate.SetAdditionalConsumerDataRequest("ME");
emvqr.SetAdditionalDataFieldTemplate(additionalDataFieldTemplate);
Parameters | Description | Type |
---|---|---|
additionalDataFieldTemplate |
Some additional data field template | AdditionalDataFieldTemplate |
MerchantInformationLanguageTemplate merchantInformationLanguageTemplate = new MerchantInformationLanguageTemplate();
merchantInformationLanguageTemplate.SetLanguagePreference("PT");
merchantInformationLanguageTemplate.SetMerchantName("Merchant Organization");
merchantInformationLanguageTemplate.SetMerchantCity("Brasilia");
emvqr.SetMerchantInformationLanguageTemplate(merchantInformationLanguageTemplate);
Parameters | Description | Type |
---|---|---|
merchantInformationLanguageTemplate |
Some merchant information language template | MerchantInformationLanguageTemplate |
string id = "27";
MerchantAccountInformation merchantAccountInformation = new MerchantAccountInformation();
merchantAccountInformation.SetGloballyUniqueIdentifier("com.p2pqrpay");
merchantAccountInformation.AddContextSpecificData("01", "PAPHPHM1XXX");
merchantAccountInformation.AddContextSpecificData("02", "99964403");
merchantAccountInformation.AddContextSpecificData("04", "09985903943");
merchantAccountInformation.AddContextSpecificData("05", "+639985903943");
emvqr.AddMerchantAccountInformation(id, merchantAccountInformation);
Parameters | Description | Type |
---|---|---|
id |
Tag ID | string |
value |
Some merchant account information | string |
string id = "80";
string unreservedTemplate = new UnreservedTemplate();
unreservedTemplate.SetGloballyUniqueIdentifier("A011223344998877");
unreservedTemplate.AddContextSpecificData("07", "12345678");
emvqr.AddUnreservedTemplates(id, unreservedTemplate);
Parameters | Description | Type |
---|---|---|
id |
Tag ID | string |
value |
Some unreserved template | string |
string id = "03";
string value = "12345678";
emvqr.AddRFUforEMVCo(id, value);
Parameters | Description | Type |
---|---|---|
id |
Tag ID | string |
value |
Some value | string |
You can use this Module by importing:
using emv_qrcps.QrCode.Consumer;
BERTLV berTLV = new BERTLV();
// ... OR
BERTLV berTLV = new BERTLV(
dataApplicationDefinitionFileName,
dataApplicationLabel,
dataTrack2EquivalentData,
dataApplicationPAN,
dataCardholderName,
dataLanguagePreference,
dataIssuerURL,
dataApplicationVersionNumber,
dataIssuerApplicationData,
dataTokenRequestorID,
dataPaymentAccountReference,
dataLast4DigitsOfPAN,
dataApplicationCryptogram,
dataApplicationTransactionCounter,
dataUnpredictableNumber
);
Parameter | Description | Type |
---|---|---|
dataApplicationDefinitionFileName |
Application Definition Name | string(in-hex-decimal-format) |
dataApplicationLabel |
Application Label | string |
dataTrack2EquivalentData |
Track to equivalent data | string(in-hex-decimal-format) |
dataApplicationPAN |
Application PAN | string(in-hex-decimal-format) |
dataCardholderName |
Cardholder Name | string |
dataLanguagePreference |
Language Preference | string |
dataIssuerURL |
Issuer URL | string |
dataApplicationVersionNumber |
Application Version Number | string(in-hex-decimal-format) |
dataIssuerApplicationData |
Issuer Application Data | string(in-hex-decimal-format) |
dataTokenRequestorID |
Token Requestor ID | string(in-hex-decimal-format) |
dataPaymentAccountReference |
Payment Account Reference | string(in-hex-decimal-format) |
dataLast4DigitsOfPAN |
Last 4 digits of PAN | string(in-hex-decimal-format) |
dataApplicationCryptogram |
Application Cryptogram | string(in-hex-decimal-format) |
dataApplicationTransactionCounter |
Application Transaction Counter | string(in-hex-decimal-format) |
dataUnpredictableNumber |
Unpredictable Number | string(in-hex-decimal-format) |
Return Type | Description |
---|---|
BERTLV |
It means the TLV Object of the consumer module. |
ApplicationSpecificTransparentTemplate applicationSpecificTransparentTemplate = new ApplicationSpecificTransparentTemplate();
// ... OR
ApplicationSpecificTransparentTemplate applicationSpecificTransparentTemplate = new ApplicationSpecificTransparentTemplate(
berTLV = BERTLV()
);
Parameter | Description | Type |
---|---|---|
berTLV |
BERTLV Object | BERTLV |
Return Type | Description |
---|---|
ApplicationSpecificTransparentTemplate |
It means an object that stores an application specific transparent template. |
ApplicationTemplate applicationTemplate = new ApplicationTemplate();
// ... OR
ApplicationTemplate applicationTemplate = new ApplicationTemplate(
berTLV = BERTLV(),
applicationSpecificTransparentTemplates = []
);
Parameter | Description | Type |
---|---|---|
berTLV |
BERTLV Object | BERTLV |
applicationSpecificTransparentTemplates |
Application specific transparent templates | array (ApplicationSpecificTransparentTemplate) |
Return Type | Description |
---|---|
ApplicationTemplate |
It means an object that stores an application template. |
CommonDataTransparentTemplate commonDataTransparentTemplate = new CommonDataTransparentTemplate();
// ... OR
CommonDataTransparentTemplate commonDataTransparentTemplate = new CommonDataTransparentTemplate(
berTLV = BERTLV()
);
Parameter | Description | Type |
---|---|---|
berTLV |
BERTLV Object | BERTLV |
Return Type | Description |
---|---|
CommonDataTransparentTemplate |
It means an object that stores a common data transparent template. |
CommonDataTemplate commonDataTemplate = new CommonDataTemplate();
// ... OR
CommonDataTemplate commonDataTemplate = new CommonDataTemplate(
berTLV = BERTLV(),
commonDataTransparentTemplates = []
);
Parameter | Description | Type |
---|---|---|
berTLV |
BERTLV Object | BERTLV |
commonDataTransparentTemplates |
Common data transparent templates | AppTemplate[] |
Return Type | Description |
---|---|
CommonDataTemplate |
It means an object that stores a common data template. |
ConsumerEMVQR emvqr = new ConsumerEMVQR();
// ... OR
ConsumerEMVQR emvqr = new ConsumerEMVQR(
dataPayloadFormatIndicator,
applicationTemplates,
commonDataTemplates
);
Parameter | Description | Type |
---|---|---|
dataPayloadFormatIndicator |
Payload Format Indicator | string |
applicationTemplates |
Application Templates | AppTemplate[] |
commonDataTemplates |
Common Data templates | CommonTemplate[] |
Return Type | Description |
---|---|
ConsumerEMVQR |
It means an object that represents an EMV QRCode. |
Represents a Basic Encoding Rules TAG + Length + Value.
using emv_qrcps.QrCode.Consumer;
using emv-qrcps.QrCode.Merchant;
BERTLV berTLV = new BERTLV();
berTLV.SetDataApplicationDefinitionFileName("A0000000555555");
Parameters | Description | Type |
---|---|---|
dataApplicationDefinitionFileName |
Application Definition File (ADF) Name | string(in-hex-decimal-format) |
berTLV.SetDataApplicationLabel("Product1");
Parameters | Description | Type |
---|---|---|
SetDataApplicationLabel |
Application Label | string |
berTLV.SetDataTrack2EquivalentData("AABBCCDD");
Parameters | Description | Type |
---|---|---|
dataTrack2EquivalentData |
Track 2 Equivalent Data | string(in-hex-decimal-format) |
berTLV.SetDataApplicationPAN("1234567890123458");
Parameters | Description | Type |
---|---|---|
dataApplicationPAN |
Application PAN | string(in-hex-decimal-format) |
berTLV.SetDataCardholderName("CARDHOLDER/EMV");
Parameters | Description | Type |
---|---|---|
dataCardholderName |
Cardholder Name | string |
berTLV.SetDataLanguagePreference("ruesdeen");
Parameters | Description | Type |
---|---|---|
dataLanguagePreference |
Language Preference | string |
berTLV.SetDataIssuerURL("http://someuri.com");
Parameters | Description | Type |
---|---|---|
dataIssuerURL |
Issuer URL | string |
berTLV.setDataApplicationVersionNumber("04");
Parameters | Description | Type |
---|---|---|
dataApplicationVersionNumber |
Application Version Number | string(in-hex-decimal-format) |
berTLV.SetDataIssuerApplicationData("06010A03000000");
Parameters | Description | Type |
---|---|---|
dataIssuerApplicationData |
Issuer application data | string(in-hex-decimal-format) |
berTLV.SetDataTokenRequestorID("0601AABBCC");
Parameters | Description | Type |
---|---|---|
dataTokenRequestorID |
Token Requestor ID | string(in-hex-decimal-format) |
berTLV.SetDataPaymentAccountReference("0708AABBCCDD");
Parameters | Description | Type |
---|---|---|
dataPaymentAccountReference |
Payment Account Reference | string(in-hex-decimal-format) |
berTLV.SetDataLast4DigitsOfPAN("07080201");
Parameters | Description | Type |
---|---|---|
dataLast4DigitsOfPAN |
Last 4 Digits of PAN | string(in-hex-decimal-format) |
berTLV.SetDataApplicationCryptogram("584FD385FA234BCC");
Parameters | Description | Type |
---|---|---|
dataApplicationCryptogram |
Application Cryptogram | string(in-hex-decimal-format) |
berTLV.SetDataApplicationTransactionCounter("0001");
Parameters | Description | Type |
---|---|---|
dataApplicationTransactionCounter |
Application Transaction Counter | string(in-hex-decimal-format) |
berTLV.SetDataUnpredictableNumber("6D58EF13");
Parameters | Description | Type |
---|---|---|
dataUnpredictableNumber |
Unpredictable Number | string(in-hex-decimal-format) |
berTLV.Format();
Return Type | Description |
---|---|
string |
BERTLV in string format |
string berTlvBinaryFormat = berTLV.DataWithType(MerchantConsts.DATA_TYPE.BINARY, ' '); // Binary Data (shown as hex bytes)
// OR
string berTlvRawFormat = berTLV.DataWithType(MerchantConsts.DATA_TYPE.RAW, ' '); // Raw Data
Parameters | Description | Type |
---|---|---|
dataType |
Data type value | MerchantConsts.DATA_TYPE.BINARY | MerchantConsts.DATA_TYPE.RAW |
indent |
Indent character (Ex.: ' ') | string |
Return Type | Description |
---|---|
string |
BERTLV in binary OR raw data format |
Represents an application specific transparent template.
using emv_qrcps.QrCode.Consumer;
using emv_qrcps.QrCode.Merchant;
ApplicationSpecificTransparentTemplate applicationSpecificTransparentTemplate = new ApplicationSpecificTransparentTemplate();
BERTLV berTLV = new BERTLV();
// Setters assignments in berTLV
applicationSpecificTransparentTemplate.SetBERTLV(berTLV);
Parameters | Description | Type |
---|---|---|
berTLV |
BERTLV Object | BERTLV |
applicationSpecificTransparentTemplate.Format();
Return Type | Description |
---|---|
string |
ApplicationSpecificTransparentTemplate in string format |
string binaryFormat = applicationSpecificTransparentTemplate.DataWithType(MerchantConsts.DATA_TYPE.BINARY, ' '); // Binary Data (shown as hex bytes)
// OR
string rawFormat = applicationSpecificTransparentTemplate.DataWithType(MerchantConsts.DATA_TYPE.RAW, ' '); // Raw Data
Parameters | Description | Type |
---|---|---|
dataType |
Data type value | MerchantConsts.DATA_TYPE.BINARY | MerchantConsts.DATA_TYPE.RAW |
indent |
Indent character (Ex.: ' ') | string |
Return Type | Description |
---|---|
string |
Application specific transparent template in binary OR raw data format |
Represents a common data transparent template.
using emv_qrcps.QrCode.Consumer;
using emv_qrcps.QrCode.Merchant;
CommonDataTransparentTemplate commonDataTransparentTemplate = new CommonDataTransparentTemplate();
BERTLV berTLV = new BERTLV();
// Setters assignments in berTLV
commonDataTransparentTemplate.SetBERTLV(berTLV);
Parameters | Description | Type |
---|---|---|
berTLV |
BERTLV Object | BERTLV |
commonDataTransparentTemplate.Format();
Return Type | Description |
---|---|
string |
CommonDataTransparentTemplate in string format |
string binaryFormat = commonDataTransparentTemplate.DataWithType(MerchantConsts.DATA_TYPE.BINARY, ' '); // Binary Data (shown as hex bytes)
// OR
string rawFormat = commonDataTransparentTemplate.DataWithType(MerchantConsts.DATA_TYPE.RAW, ' '); // Raw Data
Parameters | Description | Type |
---|---|---|
dataType |
Data type value | MerchantConsts.DATA_TYPE.BINARY | MerchantConsts.DATA_TYPE.RAW |
indent |
Indent character (Ex.: ' ') | string |
Return Type | Description |
---|---|
string |
Common data transparent template in binary OR raw data format |
Represents an application template.
using emv_qrcps.QrCode.Consumer;
using emv_qrcps.QrCode.Merchant;
ApplicationTemplate applicationTemplate = new ApplicationTemplate();
BERTLV berTLV = new BERTLV();
// Setters assignments in berTLV
applicationTemplate.SetBERTLV(berTLV);
Parameters | Description | Type |
---|---|---|
berTLV |
BERTLV Object | BERTLV |
ApplicationSpecificTransparentTemplate applicationSpecificTransparentTemplate = Consumer.buildApplicationSpecificTransparentTemplate();
BERTLV berTLV1 = new BERTLV();
berTLV1.SetDataApplicationDefinitionFileName("A0000000555555");
berTLV1.SetDataApplicationLabel("Product1");
applicationSpecificTransparentTemplate.SetBERTLV(berTLV1);
applicationTemplate.AddApplicationSpecificTransparentTemplate(applicationSpecificTransparentTemplate);
Parameters | Description | Type |
---|---|---|
applicationSpecificTransparentTemplate |
An application specific transparent template | ApplicationSpecificTransparentTemplate |
applicationTemplate.Format();
Return Type | Description |
---|---|
string |
ApplicationTemplate in string format |
string binaryFormat = applicationTemplate.DataWithType(MerchantConsts.DATA_TYPE.BINARY, ' '); // Binary Data (shown as hex bytes)
// OR
string rawFormat = applicationTemplate.DataWithType(MerchantConsts.DATA_TYPE.RAW, ' '); // Raw Data
Parameters | Description | Type |
---|---|---|
dataType |
Data type value | MerchantConsts.DATA_TYPE.BINARY | MerchantConsts.DATA_TYPE.RAW |
indent |
Indent character (Ex.: ' ') | string |
Return Type | Description |
---|---|
string |
Common data transparent template in binary OR raw data format |
Represents a common data template.
using emv_qrcps.QrCode.Consumer;
using emv_qrcps.QrCode.Merchant;
CommonDataTemplate commonDataTemplate = new CommonDataTemplate();
BERTLV berTLV = new BERTLV();
// Setters assignments in berTLV
commonDataTemplate.SetBERTLV(berTLV);
Parameters | Description | Type |
---|---|---|
berTLV |
BERTLV Object | BERTLV |
CommonDataTransparentTemplate commonDataTransparentTemplate = new ommonDataTransparentTemplate();
BERTLV berTLV = new BERTLV();
berTLV.SetDataIssuerApplicationData("06010A03000000");
berTLV.SetDataApplicationCryptogram("584FD385FA234BCC");
berTLV.SetDataApplicationTransactionCounter("0001");
berTLV.SetDataUnpredictableNumber("6D58EF13");
commonDataTransparentTemplate.SetBERTLV(berTLV);
commonDataTemplate.AddCommonAppTemplate(commonDataTransparentTemplate);
Parameters | Description | Type |
---|---|---|
commonDataTransparentTemplate |
A common data transparent template | CommonDataTransparentTemplate |
commonDataTemplate.Format();
Return Type | Description |
---|---|
string |
CommonDataTemplate in string format |
string binaryFormat = commonDataTemplate.DataWithType(MerchantConsts.DATA_TYPE.BINARY, ' '); // Binary Data (shown as hex bytes)
// OR
string rawFormat = commonDataTemplate.DataWithType(MerchantConsts.DATA_TYPE.RAW, ' '); // Raw Data
Parameters | Description | Type |
---|---|---|
dataType |
Data type value | MerchantConsts.DATA_TYPE.BINARY | MerchantConsts.DATA_TYPE.RAW |
indent |
Indent character (Ex.: ' ') | string |
Return Type | Description |
---|---|
string |
Common data transparent template in binary OR raw data format |
Represents an EMV QRCode.
using emv_qrcps.QrCode.Consumer;
using emv_qrcps.QrCode.Merchant;
ConsumerEMVQR emvqr = new ConsumerEMVQR();
emvqr.SetDataPayloadFormatIndicator("CPV01");
Parameters | Description | Type |
---|---|---|
dataPayloadFormatIndicator |
Payload Format Indicator | string |
ApplicationTemplate applicationTemplate1 = new ApplicationTemplate();
BERTLV berTLV1 = new BERTLV();
berTLV1.SetDataApplicationDefinitionFileName("A0000000555555");
berTLV1.SetDataApplicationLabel("Product1");
applicationTemplate1.SetBERTLV(berTLV1);
emvqr.AddCommonAppTemplate(applicationTemplate1);
ApplicationTemplate applicationTemplate2 = new ApplicationTemplate();
BERTLV berTLV2 = new BERTLV();
berTLV2.SetDataApplicationDefinitionFileName("A0000000666666");
berTLV2.SetDataApplicationLabel("Product2");
applicationTemplate2.SetBERTLV(berTLV2);
emvqr.AddCommonAppTemplate(applicationTemplate2);
Parameters | Description | Type |
---|---|---|
applicationTemplate |
An application template | ApplicationTemplate |
CommonDataTemplate commonDataTemplate = new CommonDataTemplate();
BERTLV berTLV1 = new BERTLV();
berTLV1.SetDataApplicationPAN("1234567890123458");
berTLV1.SetDataCardholderName("CARDHOLDER/EMV");
berTLV1.SetDataLanguagePreference("ruesdeen");
commonDataTemplate.SetBERTLV(berTLV1);
CommonDataTemplate commonDataTransparentTemplate = Consumer.buildCommonDataTransparentTemplate();
BERTLV berTLV2 = new BERTLV();
berTLV2.SetDataIssuerApplicationData("06010A03000000");
berTLV2.SetDataApplicationCryptogram("584FD385FA234BCC");
berTLV2.SetDataApplicationTransactionCounter("0001");
berTLV2.SetDataUnpredictableNumber("6D58EF13");
commonDataTransparentTemplate.SetBERTLV(berTLV2);
commonDataTemplate.AddCommonAppTemplate(commonDataTransparentTemplate);
emvqr.AddCommonAppTemplate(commonDataTemplate);
Parameters | Description | Type |
---|---|---|
commonDataTemplate |
A common data template | CommonDataTemplate |
commonDataTemplate.GeneratePayload();
Return Type | Description |
---|---|
string |
ConsumerEMVQR in base64 string format |
string emvqrBinaryFormat = emvqr.ToBinary(); // Binary Data (shown as hex bytes)
Return Type | Description |
---|---|
string |
EMV QRCode in binary format |
string emvqrBinaryFormat = emvqr.rawData(); // Raw Data
Return Type | Description |
---|---|
string |
EMV QRCode in raw data format |