Make User PIN Alphanumeric

@emre is there any chance you can make the user PIN field alphanumeric? Currently you can only enter numbers, the issue i have is that I am trying to use magnetic cards as staff cards to log in, confirm admin PIN etc.

My card writer only seems to be able to write data to the mag card by adding % before the value and adding a ? after. So if i have a user with PIN 1234, when the card is swiped it actually produces %1234? which doesnt match the PIN of 1234 so doesnt log in, confirm admin PIN etc

If the user PIN was alphanumeric I could enter %1234? as the PIN and my cards would work fine. It would also work on the switch user setup, so I could swipe a card to auto logout and login new user. Currently i can only do this by manually typing the user PIN in or by creating it as a barcode and scanning it

I also want to use mag cards for customer entities but as the field i enter the card number in can be alphanumeric this has no issues and loads customer entities fine

So is there any chance of making the user PIN field alphanumeric? it shouldnt affect others as their numeric PINs would still work but it would help get around my issue


The solution is not to add a new feature in SambaPOS to accept more characters but instead you should configure your mag reader to format your output properly. I know this is 100% possible with most professional mag readers as I faced the same exact issue as you but quickly realized the manufacture had software included with the drivers that let you edit all the settings and format of the output when you swipe the card or scan the rfid. If I were you id just buy some cheap rfid chips on ebay and they just output numbers. I like RFID way more anyways they are much smaller and dont require any direct contact just close proximity.

1 Like

As far as I can see i can’t change the output to not include a prefix and suffix letter. In the software when swiping to check it has written properly it doesn’t include them, it’s only when you swipe in other programs they show

I would have thought making the PIN field alphanumeric should be pretty quick and easy to do

Which mag reader do you have?

MSR605X I can’t see anywhere in the settings that’ll let you create a card without % and ? Symbols at start and end

Ill show screenshots tonight, I can get it to login as I’m guessing the login screen only accepts numbers so when i format the card a certain way it works to login

However the input field on the pos screen is alphanumeric so it doesn’t work there and displays all letters and numbers

Simple solution would be to allow alphanumeric digits in PIN so I can leave the format as it and it’ll work on login screen, pos screen and switch user setup which checks the user pin against what is swiped

Then they would have to alter keypad to show full keyboard that wouldn’t look very good.

The login screen downt accept % and ?, I have used cheap magswipes which didnt offer utlity to strip the prefix/suffix and it worked fine for login screen…

As for admin pin, maybe you could look to a custom [?prompt] flow and use a mask to disregard non numeric charicters?

Not if they just used an alphanumeric field to allow mag cards with letters. The numberpad would stay the same on screen to enter number only pins

I’ve got it to work for login and admin pins, I tried a different setting and although there are letters and symbols the login and admin pin fields seem to disregard anything that isn’t a number so only the numbers from the card get Inputted which then match the user pin

Adding entity to the ticket using the mag card is fine as I can just enter any special characters or letters in the custom field used to add the entity

The main issue which you might be able to help with @JTRTech is the switch user system as I used the one you created. So now by typing the pin it works fine to logout and auto login

But as I can’t strip the symbols from my mag card encoding how can I change the action to only use the numbers from the card that is swiped, so the action strips the symbols from start and end and just uses the numbers which will match a user pin

This was the main reason for my request so that I can swipe a staff card to initiate the switch user setup. If the pin was alphanumeric it would just work and no one would see any different from the login screen as that would stay the same

Without that I’d need some help to strip the unnecessary characters from the mag card but I’m not sure how to do this and format it in the switch user actions

The simplest format that my mag card encoder outputs is %nnnmmnn? Where n are numbers, so for example a user with pin 2575613 when encoded onto a mag card outputs ad %2575613?

So I need a way to ignore the % and ? Symbols. I briefly used the subst(n,n) function before, could that be used in the action that “grabs” the pin to only use the 2nd digit as the start and use the following 6 digits as the rest of the number?

You could use a script to splice of the first and last characters, so the parts then either change [:NumberPad] to something like {CALL:tools.cutfirstandlast([:NumberPad])} or do it just once and adapt the switch user flow to start with an execute automation command cation which strips into the command value before passing into the existing flow.

Yea that’s what I thought I’d prob need to do, gunna need some help with the call bit and what I need to do to split the numbers down

Splice is the script function.
There may be a helper that would work within the action directly but not sure… Q would probably have been the person to ask that but…
A script should definatly do the job. I use a script call for my locals discount fobs which are numberpad entered based so definatly doable.

Seeing as I seem to be able to get login and admin pins working maybe Instead of just swiping the card to switch users I could create a button to press instead that opens keypad then swipe card to see if that works

Adds an extra step of pressing a button but if it works like login and admin pin does it will be much simpler to make work

Not sure, I checked admin pin and at least on keyboard it accepts ; and ? so not sure if its different on msr.
The script method should allow same flow just stripping the ; and ? but up to you.

@emre i just came across this in a post from 4 years ago!!


Sep '14

sukasem try [=’[:CommandValue]’.substr(1,6)]

I thing you are trying to strip mag card control chars. If you tell us more about your implementation I can give more info about how to deal with that.

Thats what i am trying to do, strip the first and last characters of the mag card control

The only thing this is affecting is my switch user setup where it uses the number pad entry on the pos screen. the login screen pin field and admin pin fields seem to automatically strip the control characters from the start and end and they work fine.

The numberpad entry on the pos screen doesnt do this, so for example i have a user with pin 2575613, when encoding this to a mag card it outputs as %2575613?

%2575613? works fine on the main pos login screen and logs in user with pin 2575163
%2575613? works fine for admin pin confirmation and accepts 2575613 as a pin

My switch user setup relies on a user pin being entered on the numberpad field on the pos screen, if i manually type 2575613 everything works perfect and current user logs out and user with pin 2575613 gets logged in

This obviously doesnt work when i swipe my mag card as it inputs %2575613? which isnt a user pin so doesnt work. How can a change the actions below to strip off the 1st and last characters (% and?) so the rule thinks we have just entered 2575613 and not %2575613?


So i think in need to amend [:NumberpadValue]:F.Count in the rule constraint to be numberpad value minus the first and last digit

and need to change the action command value from [:NumberpadValue] to numberpad value minus fist and last digit

ive tried a few things you suggested in the topic ive reviewed from 2014 but im not doing it correctly, not sure on what the correct string should be to amend the inputted value

i also tried this which you suggested in that topic to remove the 1st and last characters:


I changed CommanValue to NumberpadValue in the string above but this didnt work

You might need to split the rule and do the substring splicing on the first rule and pass the processed value over via automation command value.

Which substring splicing is correct? im not sure what the correct format should be to ignore 1st and last digits