What's the best way to convert a number to a byte[6]
in C#
?
I'm using MagTek Card reader
and trying to display desired amount on device screen, it should be 6-byte
array. The amount needs to be used and authorized, EMV Tag 9F02
, format n12
.
Function:
int requestSmartCard(int cardType, int comfirmationTime, int pinEnteringTime, int beepTones, int option, byte [] amount, int transactionType, byte[] cashback, byte [] reserved);
And the description for amount param is: - amount The amount to be used and authorized, EMV Tag 9F02, format n12. It should be a 6-byte array.
EDIT:
This is example code from their example in C#:
byte []amount = new byte[6];
amount[3] = 1;
byte []cashBack = new byte[6];
PrintMsg(String.format("start a emv transaction"));
byte reserved[] = new byte[26];
byte cardType = 2;
byte confirmWaitTime = 20;
byte pinWaitTime = 20;
byte tone = 1;
byte option = 0;
byte transType = 4;
retCode = m_MTSCRA.requestSmartCard(cardType, confirmWaitTime, pinWaitTime, tone, option, amount, transType, cashBack, reserved);
and then on device's screen amount of 100.00 $ is shown.
EDIT: I changed the question form float to byte[6] to number to byte[6].