Announcing Mobile SDK V2.0
As you might have read over at our PayPal Forward Blog it’s time to celebrate for PayPal | Developer. One year ago we relaunched our Developer Platform with way clearer documentation, new REST APIs and our CardIO-enhanced Mobile SDK that allows for frictionless payments on Android and iOS.
Today I want to quickly elaborate on an amazing new feature of our mSDK version 2.0 called Future Payments that allows for great use-cases like subscription payments without requiring the user to re-authorize each payment by logging in again. Great experiences like the ones that you can find when using Uber can be created by using this kind of payment. By authorizing the application once to handle future transaction the user grants the application a revokable token that will be passed in all future transactions and therefore skips the login step.
Implementing this step is actually very easy as our SDK got even easier with version 2. First of all we need to change the configuration of the SDK slightly. In the following examples I will showcase how to do so when working on Android apps – bear in mind that implementing this feature in iOS is equally easy to handle:
private static PayPalConfiguration config = new PayPalConfiguration() | |
.environment(CONFIG_ENVIRONMENT) | |
.clientId(CONFIG_CLIENT_ID) | |
// The following are only used in PayPalFuturePaymentActivity. | |
.merchantName("Innovative cab app") | |
.merchantPrivacyPolicyUri(Uri.parse("https://www.example.com/privacy")) | |
.merchantUserAgreementUri(Uri.parse("https://www.example.com/legal")); |
If you’ve worked with our SDK prior this version you will see that the configuration got much easier by removing all Intent Extras and adding dedicated methods for initializing the SDK.
After the user logged in an OAuth 2.0 authorize token is being returned which can be exchanged against a short-lived access token. Furthermore a refresh token is being returned which we will need to acquire a new access token once the previous one becomes invalid.
Intent intent = new Intent(MyActivity.this, PayPalFuturePaymentActivity.class); | |
startActivityForResult(intent, REQUEST_CODE_FUTURE_PAYMENT); |
By using the startActivityForResult
mechanism we receive the PayPalAuthorization
in onActivityForResult
:
@Override | |
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
if (requestCode == REQUEST_CODE_FUTURE_PAYMENT) { | |
if (resultCode == Activity.RESULT_OK) { | |
PayPalAuthorization auth = data | |
.getParcelableExtra(PayPalFuturePaymentActivity.EXTRA_RESULT_AUTHORIZATION); | |
if (auth != null) { | |
String authorization_code = auth.getAuthorizationCode(); | |
// send authorization code to server to receive the access & refresh code | |
} | |
} | |
} | |
} |
The payment is being handled on server-side – to do so we hand over the app’s correlation ID and payment details to the backend. To acquire the correlation ID we leverage a method that we introduced with version 2.0 of the SDK:
String correlationId = PayPalConfiguration.getApplicationCorrelationId(this); |
It is required that the application provides a way to revoke the token on client-side to ensure a user-friendly experience.
We are looking forward to bringing even more great features to the SDK and are as always keen for your feedback!
Best regards,
Tim
Announcing Mobile SDK V2.0的更多相关文章
- 原因是未找到“sgen.exe”,或未安装 .NET Framework SDK v2.0
visual studio编译出现错误:错误 2 任务失败,原因是未找到“sgen.exe”,或未安装 .NET Framework SDK v2.0.该任务正在注册表项 HKEY_LOCAL_MAC ...
- Deepin15.8系统下安装QorIQ Linux SDK v2.0 yocto成功完美运行的随笔
2019.2.17日:最终安装成功,完美解决! 2019.2.16日:最终安装未成功,但是过程中排除 了几个bug,前进了几步,仅供参考. 写在最前面,yocto安装是有系统要求的,Deepin 15 ...
- Kinect for Windows SDK v2.0 开发笔记 (十五) 手势帧
(转载请注明出处) 使用SDK: Kinect for Windows SDK v2.0 public preview1409 同前面,由于SDK未完毕,不附上函数/方法/接口的超链接. 这次最 ...
- Gprinter Android SDK V2.0 使用说明
佳博特约经销商,此店购买的打印机问题优先解决哟 https://shop107172033.taobao.com/index.htm?spm=2013.1.w5002-9520741823.2.V1p ...
- Hi3531 SDK v2.0.8.0 安装
1.Hi3531 SDK包位置 在"Hi3531_V100R001***/01.software/board"目录下,您可以看到一个 Hi3531_SDK_Vx.x.x.x.tgz ...
- ".NET Compact Framework v2.0 could not be found."
参考: http://blog.csdn.net/godcyx/article/details/7348431 问题原因: That's a known issue where VS can't di ...
- 编译器错误消息: CS0016: 未能写入输出文件“c:/Windows/Microsoft.NET/Framework/v2.0.50727/....dll”--“拒绝访问。
错误如下: “/”应用程序中的服务器错误. 编译错误 说明: 在编译向该请求提供服务所需资源的过程中出现错误.请检查下列特定错误详细信息并适当地修改源代码. 编译器错误消息: CS0016: 未能写入 ...
- ArcGIS Runtime for Android开发教程V2.0(4)基础篇---MapView
原文地址: ArcGIS Runtime for Android开发教程V2.0(4)基础篇---MapView - ArcGIS_Mobile的专栏 - 博客频道 - CSDN.NET http:/ ...
- ArcGIS Runtime for Android开发教程V2.0(2)开发环境配置
原文地址: ArcGIS Runtime for Android开发教程V2.0(2)开发环境配置 - ArcGIS_Mobile的专栏 - 博客频道 - CSDN.NET http://blog.c ...
随机推荐
- SQL Case when 的使用方法 (转)
Case具有两种格式.简单Case函数和Case搜索函数. --简单Case函数 CASE sex WHEN '1' THEN '男' WHEN '2' THEN '女' ELSE '其他' END ...
- Kylin使用笔记-1: 安装
2016年1月14日 9:57:23 星期四 背景介绍 Apache Kylin是一个开源的分布式分析引擎,提供Hadoop之上的SQL查询接口及多维分析(OLAP)能力以支持超大规模数据,最 ...
- js获取iframe的id
有一个需求是在iframe页面调用父页面一个方法,开始我用window.parent.length来判断页面有几个层,但是不好用,因为我的浏览器安装了一个插件,这个插件会动态向页面插入一个iframe ...
- LoadRunner测试ajax框架,回放后系统中没有产生数据解决方法
1.QTP11 下载地址:http://www.genilogix.com/downloads/unified-functional-testing/quicktest-professional-11 ...
- docker 安装错误Transaction Check Error
安装docker提示:Transaction Check Error: file /usr/bin/docker from install of docker-io-1.7.1-2.el6.x86_6 ...
- CentOS 配置自启动Redis
第一步: 在/etc/init.d/目录下建立一个名字为 redis 的启动脚本 cd /etc/init.d touch redis 然后在这个脚本中添加如下脚本 <注意修改自己的PIDFI ...
- 一文搞定 Mybatis 的应用
Mybatis 介绍 Mybatis 是一个开源的持久层框架,原来叫 ibatis ,它对 jdbc 操作数据库的过程进行了封装,使开发者只需要关注 SQL 本身,而不需要花费精力去处理例如注册驱动. ...
- Java注解Annotation(一)
Java注解Annotation(一)——简介 这一章首先简单介绍一下注解,下一章会给出一个注解应用的DEMO. 1. 元注解 元注解的作用是负责注解其他的注解. JDK1.5中,定义了4个标准的me ...
- webstorm2018最新激活码license server
2018.7.5最新激活码: license server:https://s.tuzhihao.com:666/ 以后持续更新....
- C# NPOCO 轻量级ORM框架(进阶)
继续翻译NPOCO wiki. 这篇将home上 下面的几个页面翻译. wiki地址:https://github.com/schotime/NPoco/wiki 上一篇: http://www.cn ...