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 ...
随机推荐
- 【LOJ】#2562. 「SDOI2018」战略游戏
题解 圆方树建好之后点是原来的两倍,而st表求lca也要开到点的两倍,所以是四倍 我并没有开小,然而= =,我的预处理log2,写成了200000,而不是400000 我是不是折翼啊= = 很可写,我 ...
- Caffe训练AlexNet网络模型——问题二
训练时,出现Check failed:error == cudaSuccess (2 vs. 0) out of memory,并且accruary = 0,如下图所示: 解决方法:将train_va ...
- 8-2 Party Games uva1610 (贪心)
题意: 给出n个串(n为偶数): 要构造一个串,使n串中有一半小于等于它,另外一半大于它: 要求这个串长度尽量小,同时字典序小: 一开始我的优先级是放左 其实优先级是放左加一. 如 AAAA AA ...
- CentOS 打包压缩文件 zip 命令详解
我们再linux中常见的压缩文件有.tar.gz,.zip,.gz,在linux中,你要习惯没有.rar的日子. 一下为tar,zip命令详解 tar -zcvf /home/files.tar.gz ...
- 2017-2018-1 20179202《Linux内核原理与分析》第八周作业
一 .可执行程序的装载 1. 预处理.编译.链接 gcc –e –o hello.cpp hello.c //预处理 gcc -x cpp-output -S -o hello.s hello.cpp ...
- HTML 模板继承
网站模板的设计,一般的,我们做网站有一些通用的部分,比如 导航,底部,访问统计代码等.合理的规划模板往往会减少工作量,同时也使得罗乱.难以阅读的静态页面布局变得优雅. 假设,我们的网站主页面除了正文是 ...
- opencv 加载 修改 保存 图像
#include <opencv2/opencv.hpp> #include <iostream> using namespace cv; /* 1 加载图像 cv::imre ...
- [BZOJ3560]DZY Loves Math V(欧拉函数)
https://www.cnblogs.com/zwfymqz/p/9332753.html 由于欧拉函数是积性函数,可以用乘法分配律变成对每个质因子分开算最后乘起来.再由欧拉函数公式和分配律发现就是 ...
- 鸟哥的私房菜:Bash shell(五)-数据流重导向
数据流重定向 数据流重导向就是将某个指令执行后应该要出现在屏幕上的数据, 给他传输到其它的地方,例如档案或者是装置 (例如打印机之类的!)!这玩意儿在 Linux 的文字模式底下可重要的! 尤其是如果 ...
- 【转载】VC操作剪切板
1.在剪切板上放置数据 if(OpenClipboard()) //打开剪切板{ EmptyClipboard(); //清空剪切板 CString str; //从控件 ...