The barcode reader we used worked like a keyboard. When the trigger was pulled the code was read and returned as a sequence of key presses. We just used a standard text input widget and the code appeared as if someone was typing it very very quickly.
Scanner works like input device. The scanner should put the value directly to input field.
Andrie has answered a similar question, you may check it out : https://forum.mendix.com/link/questions/100612
Basically: download the barcode scanner app from the AppStore and follow their documentation. It does make a difference if your app is a Hybrid mobile web application or a Native mobile application. Take the barcode-scanner.
For creation of barcodes for use during testing you can use https://mydemoversion8-sandbox.mxapps.io/p/barcode