apple pay集成

You’ll learn how to integrate one of the most used payment gateways, GPay, into your existing Android app. Along with the integration, this article also includes whether the user can pay using GPay and the execution process.

您将学习如何将最常用的支付网关之一GPay集成到现有的Android应用中。 除了集成之外,本文还包括用户是否可以使用GPay进行支付以及执行过程。

为什么选择GPay? (Why GPay?)

As humans, our tendency to do work is mostly dependent on our ability to do it.

作为人类,我们的工作倾向主要取决于我们的工作能力。

Sure, the customer can pick their card and enter their details, but why not make it a bit easier for the customer by using the payment details that already exist in their mobile, like GPay.

当然,客户可以选择他们的卡并输入他们的详细信息,但是为什么不使用GPay这样的移动设备中已有的付款详细信息来使客户更轻松一些。

Implementing payment gateways like this in your app will increase the chances of the user actually paying.

在您的应用中实现像这样的支付网关将增加用户实际支付的机会。

Almost every Android user, in one way or another, depends on Google for some reason, such as Google Assistant for reminders, Keep for note-taking, and recently, Google Pay for payments.

几乎每个Android用户出于某种原因都依赖Google,例如Google Assistant进行提醒,Keep进行笔记以及最近使用Google Pay进行付款。

积分 (Integration)

Here, we use the Google Pay API to integrate the GPay payment gateway. To integrate this, add the following line under the dependencies node in the app level build.gradle file.

在这里,我们使用Google Pay API集成GPay付款网关。 要集成此功能,请在应用程序级别build.gradle文件中的dependencies节点下添加以下行。

implementation "com.google.android.gms:play-services-wallet:18.0.0"

We need to add the following metadata in the manifest file to enable the API.

我们需要在清单文件中添加以下元数据以启用API。

<meta-data    android:name="com.google.android.gms.wallet.api.enabled"    android:value="true" />

配置Google Pay API (Configure the Google Pay API)

Now that we’re done with the integration part, it’s time to configure the API. To use the API, we have to instantiate a client object, through which we can make calls to the Google Pay API. Have a look:

现在我们已经完成了集成部分,是时候配置API了。 要使用该API,我们必须实例化一个客户端对象,通过该对象我们可以调用Google Pay API。 看一看:

For the development purpose here, I used ENVIRONMENT_TEST, but when you’re ready to roll out to production, you can change the environment to production by changing it to ENVIRONMENT_PRODUCTION.

出于开发目的,我使用了ENVIRONMENT_TEST ,但是当您准备将其投入生产时,可以通过将ENVIRONMENT_PRODUCTION更改为ENVIRONMENT_PRODUCTION来将ENVIRONMENT_PRODUCTION更改为生产ENVIRONMENT_PRODUCTION

创建一个请求 (Create a Request)

To create a request, first, we need to create a JSON object, including all the card types and payment authentications that we support. Have a look:

要创建请求,首先,我们需要创建一个JSON对象,包括我们支持的所有卡类型和付款身份验证。 看一看:

You can find a complete list of card parameters you can use to configure the request in the documentation.

您可以在文档中找到可用于配置请求的卡参数的完整列表。

About card authentication mechanisms: When processing payments, cards can be picked as to how the transaction is authenticated against the processor or gateway.

关于卡身份验证机制:处理付款时,可以选择卡以了解如何根据处理器或网关对交易进行身份验证。

While using the primary account number (PAN) authentication, the card account number and expiry month and year are sent to the payment processor. This allows your users to use previously stored cards.

在使用主帐号(PAN)身份验证时,卡帐号以及有效期月和年被发送到付款处理器。 这使您的用户可以使用以前存储的卡。

Dynamic cryptogram based authentication works in combination with card tokenization, a mechanism that replaces your customer’s card information with a random value that no one, other than your customer’s card issuer, can understand.

基于动态密码的身份验证与卡令牌化结合使用,该机制用随机值替换客户的卡信息,而客户的发卡机构则无法理解。

This, in combination with dynamic cryptograms, ensures that the token sent to the processor is always different for every transaction, significantly increasing security in these operations. API docs.

结合动态密码,可以确保发送到处理器的令牌对于每个事务始终是不同的,从而显着提高了这些操作的安全性。 API文档 。

Along with that, we should also specify which API version of Google Pay you’re connecting to. Have a look:

除此之外,我们还应该指定您要连接的Google Pay API版本。 看一看:

Now that we have what we need to create a request, it’s time to create one and verify whether they can pay through the Google Pay API. Have a look:

现在我们有了创建请求所需的内容,是时候创建一个请求并验证他们是否可以通过Google Pay API进行付款了。 看一看:

Here, first, we’re creating an IsReadyToPayRequest, which we use to invokethe isreadyToPay function, which results in a task object.

在这里,首先,我们创建一个IsReadyToPayRequest ,我们将使用它来调用isreadyToPay函数,该函数将生成一个task对象。

Next on the task object, we have to add addOnCompleteListener to check whether the Google Pay API is available or not. Finally, when we get a successful response, we can enable the Google Pay button.

接下来,在task对象上,我们必须添加addOnCompleteListener来检查Google Pay API是否可用。 最后,当我们获得成功的响应时,我们可以启用Google Pay按钮。

现在该付款了 (It’s Time to Pay)

Finally, it’s time to pay. To create a transaction, we need two sets of data, such as transactionInfo and merchantInfo.

最后,该付款了。 要创建交易,我们需要两组数据,例如transactionInfomerchantInfo

交易信息 (TransactionInfo)

This is where we can define details like the amount they have to pay and in which currency. Have a look:

在这里,我们可以定义详细信息,例如必须支付的金额以及使用哪种货币。 看一看:

MerchantInfo (MerchantInfo)

This is where we can define merchant details like their name and merchant ID. Have a look:

在这里,我们可以定义商家详细信息,例如其名称和商家ID。 看一看:

Now, it’s time to combine the payment configuration that we created previously with transactionInfo and merchantInfo. Have a look:

现在,是时候将我们先前创建的付款配置与transactionInfomerchantInfo结合起来了。 看一看:

Finally, we’ve created a paymentDataRequest by passing the paymentDataRequestJson, then executing the task using the resolveTask function, which has three parameters, Task<TResult>, Activity, and Int as request-id. Have a look:

最后,我们通过传递paymentDataRequestJson创建了一个paymentDataRequest ,然后使用resolveTask函数执行任务,该函数具有三个参数, Task<TResult>ActivityInt作为request-id 。 看一看:

Now the user will proceed with the Google Pay transaction, and after completing it, you’ll receive the response of the transaction in onActivityResult. You can handle all success and failure states, as shown below.

现在,用户将继续进行Google Pay交易,完成交易后,您将在onActivityResult收到交易的响应。 您可以处理所有成功和失败状态,如下所示。

Thank you for reading.

感谢您的阅读。

翻译自: https://medium.com/better-programming/how-to-integrate-google-pay-into-your-existing-android-app-d75b269cd623

apple pay集成


http://www.taodudu.cc/news/show-4739562.html

相关文章:

  • Xsolla与GPay合作,全面开通土耳其市场
  • 你在自学软件测试吗?学软件测试10本必看书
  • 【记忆化搜索】 hdu2452 Navy maneuvers
  • hdoj 2452 Navy maneuvers
  • 【DFS(记忆化)】hdu 2452 Navy maneuvers
  • HDU 2452 Navy maneuvers (记忆化搜索)
  • 博弈背景下的记忆化搜索/题意理解 (HDU 2452 Navy maneuvers)
  • Adams/Car和Matlab联合仿真
  • HDU2452 Navy maneuvers 记忆化搜索
  • Navy maneuvers(dfs)
  • 如何批量增加视频的音量(ffmpeg)
  • idea里把选中的变为大写或小写快捷键
  • C++字符串数组中小写转大写的写法(指针)
  • 人生苦短,该是及时行乐?或是该苦尽甘来?
  • 人生苦短,为何一定要学Python?
  • Qt win7中读取Excel会出现闪退的问题
  • html边角效果图,PS制作卷边/卷角效果图2种方法,PS交错的作用,PS压缩图像方法,PSHTML+图像的解释,PS颜色位数的作用...
  • ps cc2019版为什么做图一复制图层就卡死_PS制作一张具有故障艺术效果的人物海报...
  • 「前端」webp图片适配流量优化
  • 如何对移动端的图片流量进行优化
  • 如何用技术手段将图片背景变为透明?
  • 图片流量优化
  • Photoshop制作清晰的透明PNG图片的方法和技巧
  • oracle 修改时间字段的格式
  • CPU接口信号说明
  • [笔记][java 4 android] [028~034]接口、异常和I/O流
  • USB研究(二)U盘驱动前的初始化
  • ZZ:windbg 常用命令
  • 接口的基本语法与应用28,29
  • widbg命令解释

apple pay集成_如何将Google Pay集成到您现有的Android应用中相关推荐

  1. 谷歌pay 手续费_您可以使用Google Pay进行的所有操作

    谷歌pay 手续费 Google Pay has really grown over the last several months. It stepped away from the Android ...

  2. (最新react-native-0.59.5) 如何将ReactNative项目集成到现有得Android项目中(两种实现方法之一)

    背景:最近在学习React-Native相关的知识,有个需求,如果已经存在一个成熟的Android 或者 IOS项目,如何实现在后续的开发中用RN来实现部分功能.再此我只是讲解一下Android de ...

  3. iis php mysql 集成_如何在IIS上集成php(iis+mysql+php+zend)

    下面介绍下如何在IIS上集成php. 这里我就不说cgi了,因为cgi需要系统权限过高,不建议虚拟主机使用,而且cgi程序也很少有人用到,楼主说的要iis6.0结合php 安装需要:windows20 ...

  4. java docker 持续集成_最佳实战Docker持续集成图文详解

    前言 关于Docker的文章铺天盖地,但精品文章往往翻译居多.都说Docker天生适合持续集成/持续部署,但同样,可落地.实际可操作性的文章也很罕见. 基于这些情况,虽然我们专栏定位为运维管理性文字, ...

  5. Google Pay India(UPI) 印度

    印度市场独有的UPI 实现Google Pay 一.官网地址(科学上网) 官方对接文档 https://developers.google.com/pay/india/api/android/goog ...

  6. Google Pay接入

    1.由于业务需求,准备接入Google Pay,一开始本人接到这个需求的时候,就开始到Google Pay官网以及Google.百度上搜索如何接入Google Pay,也是有发现一些文章.在我处理了一 ...

  7. apple pay 技术_如何在手机上设置Apple Pay和Google电子钱包

    apple pay 技术 In case you hadn't noticed recently, paying for stuff with your phone is becoming a pre ...

  8. Google Pay 初步集成

    准备工作 Google Play Console 的账号 一个地点在美国或者香港等地方的vpn(下面有介绍原因) 一部有Google Play应用市场的手机 项目内的操作 首先GoogleSample ...

  9. tinder卡在火山界面_每日新闻摘要:Tinder在Google Pay上滑动

    tinder卡在火山界面 When Google Apps take payments using Google Pay, Google takes a cut of the money. Now T ...

最新文章

  1. 2.什么是变量的数据类型
  2. redis分布式锁-基本概念与实现方式对比
  3. JMS中queue和topic区别
  4. 64位有符号与无符号类型的整数
  5. JAVA 雪花算法 唯一ID生成工具类
  6. php this validate,php扩展ZF——Validate扩展
  7. ngRoute+ngAnimate与JQM中的页面跳转的区别
  8. 生产环境服务器部署kvm虚拟化6,KVM虚拟化平台环境部署
  9. MATLAB-基本简介
  10. RFC2544背靠背测试——信而泰Renix测试软件实操
  11. PPT开场,吸引人的几点技巧
  12. Oracle 数据库实例
  13. 绿巨人(Hulk - Pure CSS)
  14. matlab灰色预测关联度
  15. DirectX大作业——3D场景地图
  16. Chrome打开摄像头权限
  17. 免费的艺术二维码生成器
  18. 强大的开源企业级数据库监控利器Lepus
  19. 学习discovery studio对对接结果进行分析
  20. struts2升级到2.5.30总结

热门文章

  1. 李笑来发出灵魂感叹背后:区块链投资机构正修炼“龟息大法”
  2. uniapp使用l-painter画板,海报
  3. Android - ReactNative Debug 技巧
  4. 学习中如何建立自己的资源库?
  5. C#中英文混合朗读文本代码
  6. 计算机课上玩的打字游戏,人教版信息技术三上第7课《玩打字游戏》教案.doc
  7. 10种防止网络攻击的方法
  8. vue print-js 解决 打印分页问题
  9. linux、windows中ping大数据包的命令格式
  10. 数据采样 22382份,如何才能学好Python并找到工作