Since a bar code is an optical input you would either need a dedicated piece of hardware for barcode scanning that provides USB, UART, I2C, SPI etc connection ... or ... depending on your needs ... take a different approach. The approach I once used was to use a Linux based microprocessor (eg. Raspberry Pi Zero or similar) and connect a $3 webcam to it. Then, you can install "ZBar" on the device. ZBar is a library for scanning bar codes, QR codes and more from the images captured from the webcam ... that results in the "data" retrieved optically. While this would then say that you would have to couple a Photon with another MCU environment, in practice that isn't complex. Alternatively, you could avail yourself of the Particle Cloud environment directly on the Pi (I'm new here but I believe that is possible) and run ZBar and the Particle environment concurrently on a Pi.
I would such googling on zbar and specifically reading: