Re: QR generation CRC algorytm

Solved! Go to solution
gadina
Regular Visitor

QR generation CRC algorytm

Hi there,

 

I would like to generate QRcode for merchant Erlang-app. 

Currently, I can combine the QRCode by mVISA Technical Specifications 20.05.2017

 

I generate a Tag63(CRC) by predefined standarts(CRC-16/CCITT-FALSE ,CRC-16/ARC ,CRC-16/AUG-CCITT,CRC-16/BUYPASS,CRC-16/CDMA2000,CRC-16/DDS-110,CRC-16/DECT-R,CRC-16/DECT-X,CRC-16/DNP,CRC-16/EN-13757,CRC-16/GENIBUS,CRC-16/MAXIM,CRC-16/MCRF4XX,CRC-16/RIELLO,CRC-16/T10-DIF,CRC-16/TELEDISK,CRC-16/TMS37157,CRC-16/USB,CRC-A ,CRC-16/KERMIT,CRC-16/MODBUS,CRC-16/X-25,CRC-16/XMODEM), but it seems that the CRC is not correct.

 

Example: 00020101021202164311190000119821520415205303356540515.815802IN5903KFC6006MUMBAI6304e378

  

Could you please help provide a method to calculate CRC  by Erlang (or Java/Go/PHP)?

 

 

 

5 REPLIES 5
jvenkata
Community Moderator

Re: QR generation CRC algorytm

Hello,

 

We are looking into the below request. Will keep you posted.

 

Thanks,
Jai

gadina
Regular Visitor

Re: QR generation CRC algorytm

 

I solved this problem 

Erlang

crc16(Data) ->
crc16(Data, 16#ffff).
crc16(<<>>, CRC) ->
CRC;
crc16(<<B:8, Else/binary>>, CRC) ->
crc16(Else, ((CRC bsl 8) band 16#ffff) bxor
element(((CRC bsr 8) bxor B) + 1, ?CRC16Table)). 

 

<<"16#", QrCodeCRC/binary>> = list_to_binary(io_lib:format("~.16#",[crc:crc16(QrCodeBody)]))

variable QrCodeCRC contains 4 bytes of checksum for tag63

jvenkata
Community Moderator

Re: QR generation CRC algorytm

This is great @gadina. Thanks for sharing the solution with the community members.

kishorm
Regular Visitor

Re: QR generation CRC algorytm

Hi Team,

 

I'm trying to generate "CRC calculated to ISO/IEC 3309 compliant 16 bit CRC" for generating a merchant QR code.

But the CRC generated by my approach is incorrect as per verified from below QR validation URL - 

https://technologypartner.visa.com/qrtesttoolkit/Merchant.aspx

 

Can anyone please help with Java representation of generating the CRC tag?

API_Products
Visa Developer Support Specialist

Re: QR generation CRC algorytm

Hey @kishorm,

 

I'm happy to help you resolve the issue that you're experiencing. Can you please confirm the API product that you are using for this project? Are you using Visa Direct? 

 

To provide you with further assistance, please provide the following information:

1. Endpoint
2. Request Header
3. Request Body
4. Response Header (include the x-correlation-id)
5. Response Body

Using SoapUI, you can find the x-correlation-id in the Raw Tab of the response header.

 




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.