将信用卡读卡器连接到 Web 应用程序?

2022-01-19 00:00:00 frontend javascript credit-card

有没有办法将读卡器连接到我的网络应用程序 (javascript),这样用户就不必手动输入信用卡信息?

Is there a way to connect a card reader to my web application (javascript) so that the user don't have to manually type in the credit card information?

此网络应用程序用于在商店购买产品.用户点击要购买的商品,然后在阅读器中刷信用卡,他会得到一张收据.

This web app is for buying products on a store. The user clicks on what items he want to purchase and then he swipes the credit card in the reader and he will get a receipt.

推荐答案

其实是有可能的,因为简单的 USB 读卡器作为键盘输入设备.由于它充当键盘输入,一旦输入框成为焦点,您就可以刷卡,使用一些漂亮的 jQuery 等将其推送到隐藏字段,然后从那里处理它.

Actually, it is possible due to the fact that simple USB card readers act as keyboard input devices. Since it acts as a keyboard input, once an inputbox is in focus you could swipe the card, push it to a hidden field using some nifty jQuery etc and then process it from there.

请查看我对 Maris 链接到的那个问题的回答.

2016 年 2 月

我用一个非常简单的 jQuery 实现创建了一个 GitHub Gist.

I created a GitHub Gist with a very simple jQuery implementation.

相关文章