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 ...
随机推荐
- 左列動態添加菜單Repeater
前台代碼: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="left.aspx. ...
- sql 修改列名及表名 sp_rename
因需求变更要改表的列名,平常都是跑到Enterprise manager中选取服务器->数据库->表,然后修改表,这样太麻烦了,查了一下,可以用script搞定, 代码如下: EXEC s ...
- javascript和jquery如何判断元素是否存在最佳。
在传统的Javascript里,当我们对某个页面元素进行某种操作前,最好先判断这个元素是否存在.原因是对一个不存在的元素进行操作是不允许的.例如: document.getElementById(&q ...
- 8-1 binpacking uva1149(贪心)
题意:给定N个物品的重量Li 背包的容量M 同时要求每个背包最多装两个物品 求至少要多少个背包才能装下所有物品 简单贪心 注意输出: #include<bits/stdc++.h> u ...
- thinkphp getField()获取一列或一个数据
在开发中经常要获取一个数据的情况,thinkphp中有一个getField()方法可以解决这个问题. 获取一个数据 1 2 $user = M('demo'); $data = $user->g ...
- vue 父子间组件传值
1.父组件向子组件传值: 实例截图: 实例代码: /*子组件代码*/ //child.vue <template> <div style="border: 1px soli ...
- git merge和git rebase的区别(转)
Description git rebase 和 git merge 一样都是用于从一个分支获取并且合并到当前分支,但是他们采取不同的工作方式,以下面的一个工作场景说明其区别 场景: 如图所示: ...
- HDU 3949 XOR 线性基
http://acm.hdu.edu.cn/showproblem.php?pid=3949 求异或第k小,结论是第k小就是 k二进制的第i位为1就把i位的线性基异或上去. 但是这道题和上一道线性基不 ...
- LOJ P3952 时间复杂度 noip 暴力 模拟
https://www.luogu.org/problemnew/show/P3952 模拟,日常认识到自己zz. #include<iostream> #include<cstdi ...
- 浙江省队选拔 ZJOI2015 (Round 1) 解题报告
最近莫名其妙地喜欢上了用这种格式写各省省选的全套题解= = 今年浙江省选的出题人是算法竞赛界传说级人物陈立杰,看样子他的出题风格很有特点……ABC三题难度是严格递减的,感觉如果在做第一题的时候被卡住的 ...