简体   繁体   English

如何使用Android支付api与nfc?

[英]How to use android pay api with nfc?

I am trying to implement "Tap and Pay(for payment transaction)" with NFC and Android Pay API . 我正在尝试使用NFCAndroid Pay API实现“点击和支付(用于支付交易)”

I did not find any tutorials or examples regarding this. 我没有找到任何关于此的教程或示例。

I looked at developer.android.com but did not get it. 我看了developer.android.com,但没有得到它。

The above documentation talks about communicating with NFC using Host-based Card Emulation (I might be wrong) 以上文档讨论了使用基于主机的卡仿真NFC进行通信(我可能错了)

How can this be achieved? 怎么能实现这一目标? Are there other APIs or do I have to integrate a payment protocol with a Host-based Card Emulation Service? 是否有其他API或我是否必须将支付协议与基于主机的卡仿真服务集成?

public class MyHostApduService extends HostApduService {
    @Override
    public byte[] processCommandApdu(byte[] apdu, Bundle extras) {

       //Implement PAYMENT protocol here
    }
    @Override
    public void onDeactivated(int reason) {
       ...
    }
}

Comment from icyerasor is completely right. 来自icyerasor的评论是完全正确的。 If you want to pay for something with Android pay and NFC, you should use Android Pay application. 如果您想使用Android付费和NFC支付费用,则应使用Android Pay应用程序。 You can't implement custom payment application because of security issues (for example, google doesn't allow Android pay on rooted devices or on devices with custom screen locks). 由于安全问题,您无法实施自定义支付应用程序(例如,谷歌不允许在有根设备或具有自定义屏幕锁定的设备支付Android费用 )。

As for Android Pay API - it is designed to pay without any NFC terminal - only from your application. 至于Android Pay API - 它的设计是在没有任何NFC终端的情况下付费 - 仅限于您的应用程序。 You can see typical payment flows here - those can't include any NFC contacts. 您可以在此处查看典型的付款流程 - 这些付款流程不包含任何NFC联系人。

If you wonder, what is NFC card emulation designed for - it can be used for person identification instead of cards, for storing bus tickets and etc. I think that it is possible to make a custom payment system - but it will require creating custom bank processing and NFC terminals (card readers) at least (I repeat once again that you can't use Android Pay). 如果您想知道,什么是NFC卡仿真设计 - 它可以用于人员识别而不是卡,存储公交车票等。我认为可以制作自定义支付系统 - 但它需要创建自定义银行处理和NFC终端(读卡器)至少(我再次重复你不能使用Android Pay)。 That's almost impossible for a little company which business isn't in this field (very expensive, requires lots of licensing work and time). 对于一个没有这个领域的公司来说,这几乎是不可能的(非常昂贵,需要大量的许可工作和时间)。 And even after it, your application will be banned in google play. 甚至在它之后,您的应用程序将在谷歌播放中被禁止。

Like the other commenters have noted. 像其他评论者所说的那样。

As for Android Pay API - it is designed to pay without any NFC terminal ... 至于Android Pay API - 它的设计是在没有任何NFC终端的情况下付费...

answered Aug 16 at 11:42 Jehy 8月16日11:42回答 Jehy

However, you may want to look into something like Square , they make NFC readers that accept Android Pay. 但是,你可能想要看看像Square这样的东西,他们制作接受Android Pay的NFC阅读器。 They cost about $50.00, which I personally feel is inexpensive for a small business or individual. 它们的价格约为50美元,我个人认为这对小型企业或个人来说是便宜的。

You should also look at their APIs and in particular 您还应该查看他们的API ,特别是

In-person commerce . 亲自交易 Custom iOS and Android point-of-sale apps can use the Square Register API to process payments securely with Square hardware. 自定义iOS和Android销售点应用可以使用Square Register API通过Square硬件安全地处理付款。

Armed with the $50 NFC reader and a custom built point-of-sale app you can in a round about way achieve a reasonable solution. 凭借50美元的NFC读卡器和定制的销售点应用程序,您可以在一轮中实现合理的解决方案。 Though your users will be using Android Pay or Apple Pay for contact-less payments(no point reinventing the wheel). 虽然您的用户使用Android Pay或Apple Pay进行非接触式支付(没有必要重新发明轮子)。

Disclaimer 放弃

As of the time of this answer Square APIs are not offered everywhere. 截至本答复时,Square API并未随处可用。

Important: Square APIs are currently available only in the United States and Canada. 重要提示: Square API目前仅在美国和加拿大提供。 We are working to make them available in additional countries soon. 我们正努力尽快在其他国家/地区提供这些产品。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM