├── README.md
├── package.json
├── plugin.xml
├── src
├── android
│ ├── AliPay.java
│ ├── PayResult.java
│ └── libs
│ │ └── alipaySdk-20160825.jar
└── ios
│ ├── AlipayPlugin.h
│ ├── AlipayPlugin.m
│ └── lib
│ ├── AlipaySDK.bundle
│ ├── bar@2x.png
│ ├── refresh@2x.png
│ ├── refresh_click@2x.png
│ ├── shutdown@2x.png
│ └── shutdown_click@2x.png
│ └── AlipaySDK.framework
│ ├── AlipaySDK
│ ├── Headers
│ ├── APayAuthInfo.h
│ └── AlipaySDK.h
│ ├── Info.plist
│ └── en.lproj
│ └── InfoPlist.strings
└── www
└── AliPay.js
/README.md:
--------------------------------------------------------------------------------
1 | ## cordova-plugin-alipay ##
2 |
3 | Makes your Cordova application enable to use the [Alipay SDK](https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.hT44dE&treeId=54&articleId=104509&docType=1)
4 | for mobile payment with Alipay App or Mobile Web. Requires cordova-android 4.0 or greater.
5 |
6 | ### ChangeLogs
7 | 本cordova插件是基于支付宝App支付SDK的Demo实现
8 | - 升级支付宝SDK版本到20160825;
9 | - 修改了一些bug;
10 | - 支持Android和iOS Alipay SDK
11 | ###主要功能
12 |
13 | - 主要功能是:服务器把订单信息签名后,调用该插件调用支付宝sdk进行支付,支付完成后如支付成功,如果是9000状态,还要去服务端去验证是否真正支付
14 |
15 | ### Install 安装
16 |
17 | The following directions are for cordova-cli (most people).
18 |
19 | * Open an existing cordova project, with cordova-android 4.0.0+, and using the latest CLI. TBS X5 variables can be configured as an option when installing the plugin
20 | * Add this plugin
21 |
22 | ```sh
23 | cordova plugin add https://github.com/offbye/cordova-plugin-alipay.git --variable PARTNER_ID=[你的商户PID可以在账户中查询]
24 | ```
25 | (对于android,可以不传PARTNER_ID)
26 |
27 | offline:下载后再进行安装 `cordova plugin add YOUR_DIR`
28 |
29 | ### 支持平台
30 |
31 | Android IOS
32 |
33 | ### Android API
34 |
35 | * js调用插件方法
36 |
37 | ```js
38 |
39 | //第一步:订单在服务端签名生成订单信息,具体请参考官网进行签名处理
40 | var payInfo = "xxxx";
41 |
42 | //第二步:调用支付插件
43 | cordova.plugins.AliPay.pay(payInfo,function success(e){},function error(e){});
44 |
45 | //e.resultStatus 状态代码 e.result 本次操作返回的结果数据 e.memo 提示信息
46 | //e.resultStatus 9000 订单支付成功 ;8000 正在处理中 调用function success
47 | //e.resultStatus 4000 订单支付失败 ;6001 用户中途取消 ;6002 网络连接出错 调用function error
48 | //当e.resultStatus为9000时,请去服务端验证支付结果
49 | /**
50 | * 同步返回的结果必须放置到服务端进行验证(验证的规则请看https://doc.open.alipay.com/doc2/
51 | * detail.htm?spm=0.0.0.0.xdvAU6&treeId=59&articleId=103665&
52 | * docType=1) 建议商户依赖异步通知
53 | */
54 |
55 | ```
56 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cordova-plugin-offbye-alipay",
3 | "version": "1.0.1",
4 | "description": "Makes your Cordova application enable to use the Alipay SDK",
5 | "cordova": {
6 | "id": "cordova-plugin-offbye-alipay",
7 | "platforms": [
8 | "android", "ios"
9 | ]
10 | },
11 | "repository": {
12 | "type": "git",
13 | "url": "https://github.com/offbye/cordova-plugin-alipay.git"
14 | },
15 | "keywords": [
16 | "cordova",
17 | "chromium",
18 | "alipay",
19 | "ecosystem:cordova",
20 | "cordova-ios",
21 | "cordova-android"
22 | ],
23 | "engines": [{
24 | "name": "cordova-android",
25 | "version": ">=4"
26 | }, {
27 | "name": "cordova-plugman",
28 | "version": ">=4.2.0"
29 | }],
30 | "author": "",
31 | "license": "Apache 2.0",
32 | "bugs": {
33 | "url": "https://github.com/offbye/cordova-plugin-alipay"
34 | },
35 | "homepage": "https://github.com/offbye/cordova-plugin-alipay"
36 | }
37 |
--------------------------------------------------------------------------------
/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 | AliPay
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | CFBundleURLName
53 | alipay
54 | CFBundleURLSchemes
55 |
56 | a$PARTNER_ID
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/src/android/AliPay.java:
--------------------------------------------------------------------------------
1 | package com.offbye.cordova.alipay;
2 |
3 | import org.apache.cordova.CallbackContext;
4 | import org.apache.cordova.CordovaPlugin;
5 | import org.apache.cordova.PluginResult;
6 | import org.json.JSONArray;
7 | import org.json.JSONException;
8 |
9 | import android.os.Handler;
10 | import android.os.Message;
11 | import android.text.TextUtils;
12 | import android.util.Log;
13 | import android.widget.Toast;
14 |
15 | import com.alipay.sdk.app.PayTask;
16 |
17 | public class AliPay extends CordovaPlugin {
18 |
19 | private static final int SDK_PAY_FLAG = 1;
20 | private static String TAG = "AliPay";
21 |
22 | private Handler mHandler = new Handler() {
23 | public void handleMessage(Message msg) {
24 | switch (msg.what) {
25 | case SDK_PAY_FLAG: {
26 | PayResult payResult = new PayResult((String) msg.obj);
27 | /**
28 | * 同步返回的结果必须放置到服务端进行验证(验证的规则请看https://doc.open.alipay.com/doc2/
29 | * detail.htm?spm=0.0.0.0.xdvAU6&treeId=59&articleId=103665&
30 | * docType=1) 建议商户依赖异步通知
31 | */
32 | String resultInfo = payResult.getResult();// 同步返回需要验证的信息
33 |
34 | String resultStatus = payResult.getResultStatus();
35 | if (TextUtils.equals(resultStatus, "9000")) {
36 | Toast.makeText(cordova.getActivity(), "支付成功",
37 | Toast.LENGTH_SHORT).show();
38 | } else {
39 |
40 | if (TextUtils.equals(resultStatus, "8000")) {
41 | Toast.makeText(cordova.getActivity(), "支付结果确认中",
42 | Toast.LENGTH_SHORT).show();
43 | } else {
44 | Toast.makeText(cordova.getActivity(), "支付失败",
45 | Toast.LENGTH_SHORT).show();
46 | }
47 | }
48 | break;
49 | }
50 | default:
51 | break;
52 | }
53 | }
54 | };
55 |
56 | @Override
57 | public boolean execute(String action, JSONArray args,
58 | final CallbackContext callbackContext) throws JSONException {
59 | PluginResult result = null;
60 | if ("pay".equals(action)) {
61 |
62 | //订单信息在服务端签名后返回
63 | final String payInfo = args.getString(0);
64 |
65 | if (payInfo == null || payInfo.equals("") || payInfo.equals("null")) {
66 | callbackContext.error("Please enter order information");
67 | return true;
68 | }
69 |
70 | cordova.getThreadPool().execute(new Runnable() {
71 | @Override
72 | public void run() {
73 | Log.i(TAG, " 构造PayTask 对象 ");
74 | PayTask alipay = new PayTask(cordova.getActivity());
75 | Log.i(TAG, " 调用支付接口,获取支付结果 ");
76 | String result = alipay.pay(payInfo, true);
77 |
78 | // 更新主ui的Toast
79 | Message msg = new Message();
80 | msg.what = SDK_PAY_FLAG;
81 | msg.obj = result;
82 | mHandler.sendMessage(msg);
83 |
84 | PayResult payResult = new PayResult(result);
85 | if (TextUtils.equals(payResult.getResultStatus(), "9000")) {
86 | Log.i(TAG, " 9000则代表支付成功,具体状态码代表含义可参考接口文档 ");
87 | callbackContext.success(payResult.toJson());
88 | } else {
89 | Log.i(TAG, " 为非9000则代表可能支付失败 ");
90 | if (TextUtils.equals(payResult.getResultStatus(),
91 | "8000")) {
92 | Log.i(TAG,
93 | " 8000代表支付结果因为支付渠道原因或者系统原因还在等待支付结果确认,最终交易是否成功以服务端异步通知为准(小概率状态) ");
94 | callbackContext.success(payResult.toJson());
95 | } else {
96 | Log.i(TAG, " 其他值就可以判断为支付失败,包括用户主动取消支付,或者系统返回的错误 ");
97 | callbackContext.error(payResult.toJson());
98 | }
99 | }
100 | }
101 | });
102 | return true;
103 | } else {
104 | callbackContext.error("no such method:" + action);
105 | return false;
106 | }
107 | }
108 |
109 | }
110 |
--------------------------------------------------------------------------------
/src/android/PayResult.java:
--------------------------------------------------------------------------------
1 | package com.offbye.cordova.alipay;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONObject;
import android.text.TextUtils;
public class PayResult {
private String resultStatus;
private String result;
private String memo;
public PayResult(String rawResult) {
if (TextUtils.isEmpty(rawResult))
return;
String[] resultParams = rawResult.split(";");
for (String resultParam : resultParams) {
if (resultParam.startsWith("resultStatus")) {
resultStatus = gatValue(resultParam, "resultStatus");
}
if (resultParam.startsWith("result")) {
result = gatValue(resultParam, "result");
}
if (resultParam.startsWith("memo")) {
memo = gatValue(resultParam, "memo");
}
}
}
@Override
public String toString() {
return "resultStatus={" + resultStatus + "};memo={" + memo
+ "};result={" + result + "}";
}
public JSONObject toJson(){
Map payResultsMap = new HashMap() {{
put("resultStatus", resultStatus);
put("memo", memo);
put("result", result);
}};
return new JSONObject(payResultsMap);
}
private String gatValue(String content, String key) {
String prefix = key + "={";
return content.substring(content.indexOf(prefix) + prefix.length(),
content.lastIndexOf("}"));
}
/**
* @return the resultStatus
*/
public String getResultStatus() {
return resultStatus;
}
/**
* @return the memo
*/
public String getMemo() {
return memo;
}
/**
* @return the result
*/
public String getResult() {
return result;
}
}
--------------------------------------------------------------------------------
/src/android/libs/alipaySdk-20160825.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/offbye/cordova-plugin-alipay/ba83d05c2987eb3adf3510c0e80ea9f7ce9e9d58/src/android/libs/alipaySdk-20160825.jar
--------------------------------------------------------------------------------
/src/ios/AlipayPlugin.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface AlipayPlugin : CDVPlugin
4 |
5 | @property(nonatomic,strong)NSString *partner;
6 | // @property(nonatomic,strong)NSString *seller;
7 | // @property(nonatomic,strong)NSString *privateKey;
8 | @property(nonatomic,strong)NSString *currentCallbackId;
9 |
10 | - (void) pay:(CDVInvokedUrlCommand*)command;
11 | @end
12 |
--------------------------------------------------------------------------------
/src/ios/AlipayPlugin.m:
--------------------------------------------------------------------------------
1 | #import "AlipayPlugin.h"
2 | #import
3 |
4 | @implementation AlipayPlugin
5 |
6 | -(void)pluginInitialize{
7 | CDVViewController *viewController = (CDVViewController *)self.viewController;
8 | self.partner = [viewController.settings objectForKey:@"partner"];
9 | }
10 |
11 | - (void) pay:(CDVInvokedUrlCommand*)command
12 | {
13 | self.currentCallbackId = command.callbackId;
14 | //partner和seller获取失败,提示
15 | if ([self.partner length] == 0)
16 | {
17 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示"
18 | message:@"缺少partner。"
19 | delegate:self
20 | cancelButtonTitle:@"确定"
21 | otherButtonTitles:nil];
22 | [alert show];
23 | return;
24 | }
25 |
26 | //从API请求获取支付信息
27 | NSString *signedString = [command argumentAtIndex:0];
28 |
29 | if (signedString != nil) {
30 |
31 | [[AlipaySDK defaultService] payOrder:signedString fromScheme:[NSString stringWithFormat:@"a%@", self.partner] callback:^(NSDictionary *resultDic) {
32 | if ([[resultDic objectForKey:@"resultStatus"] isEqual: @"9000"]) {
33 | [self successWithCallbackID:self.currentCallbackId messageAsDictionary:resultDic];
34 | } else {
35 | [self failWithCallbackID:self.currentCallbackId messageAsDictionary:resultDic];
36 | }
37 |
38 | NSLog(@"reslut = %@",resultDic);
39 | }];
40 |
41 | }
42 | }
43 |
44 | - (void)handleOpenURL:(NSNotification *)notification
45 | {
46 | NSURL* url = [notification object];
47 |
48 | if ([url isKindOfClass:[NSURL class]] && [url.scheme isEqualToString:[NSString stringWithFormat:@"a%@", self.partner]])
49 | {
50 | [[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) {
51 | if ([[resultDic objectForKey:@"resultStatus"] isEqual: @"9000"]) {
52 | [self successWithCallbackID:self.currentCallbackId messageAsDictionary:resultDic];
53 | } else {
54 | [self failWithCallbackID:self.currentCallbackId messageAsDictionary:resultDic];
55 | }
56 | }];
57 | }
58 | }
59 |
60 | - (void)successWithCallbackID:(NSString *)callbackID withMessage:(NSString *)message
61 | {
62 | CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message];
63 | [self.commandDelegate sendPluginResult:commandResult callbackId:callbackID];
64 | }
65 |
66 | - (void)failWithCallbackID:(NSString *)callbackID withMessage:(NSString *)message
67 | {
68 | CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:message];
69 | [self.commandDelegate sendPluginResult:commandResult callbackId:callbackID];
70 | }
71 | - (void)successWithCallbackID:(NSString *)callbackID messageAsDictionary:(NSDictionary *)message
72 | {
73 | CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:message];
74 | [self.commandDelegate sendPluginResult:commandResult callbackId:callbackID];
75 | }
76 |
77 | - (void)failWithCallbackID:(NSString *)callbackID messageAsDictionary:(NSDictionary *)message
78 | {
79 | CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:message];
80 | [self.commandDelegate sendPluginResult:commandResult callbackId:callbackID];
81 | }
82 |
83 | @end
84 |
--------------------------------------------------------------------------------
/src/ios/lib/AlipaySDK.bundle/bar@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/offbye/cordova-plugin-alipay/ba83d05c2987eb3adf3510c0e80ea9f7ce9e9d58/src/ios/lib/AlipaySDK.bundle/bar@2x.png
--------------------------------------------------------------------------------
/src/ios/lib/AlipaySDK.bundle/refresh@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/offbye/cordova-plugin-alipay/ba83d05c2987eb3adf3510c0e80ea9f7ce9e9d58/src/ios/lib/AlipaySDK.bundle/refresh@2x.png
--------------------------------------------------------------------------------
/src/ios/lib/AlipaySDK.bundle/refresh_click@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/offbye/cordova-plugin-alipay/ba83d05c2987eb3adf3510c0e80ea9f7ce9e9d58/src/ios/lib/AlipaySDK.bundle/refresh_click@2x.png
--------------------------------------------------------------------------------
/src/ios/lib/AlipaySDK.bundle/shutdown@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/offbye/cordova-plugin-alipay/ba83d05c2987eb3adf3510c0e80ea9f7ce9e9d58/src/ios/lib/AlipaySDK.bundle/shutdown@2x.png
--------------------------------------------------------------------------------
/src/ios/lib/AlipaySDK.bundle/shutdown_click@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/offbye/cordova-plugin-alipay/ba83d05c2987eb3adf3510c0e80ea9f7ce9e9d58/src/ios/lib/AlipaySDK.bundle/shutdown_click@2x.png
--------------------------------------------------------------------------------
/src/ios/lib/AlipaySDK.framework/AlipaySDK:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/offbye/cordova-plugin-alipay/ba83d05c2987eb3adf3510c0e80ea9f7ce9e9d58/src/ios/lib/AlipaySDK.framework/AlipaySDK
--------------------------------------------------------------------------------
/src/ios/lib/AlipaySDK.framework/Headers/APayAuthInfo.h:
--------------------------------------------------------------------------------
1 | //
2 | // APAuthInfo.h
3 | // AliSDKDemo
4 | //
5 | // Created by 方彬 on 14-7-18.
6 | // Copyright (c) 2014年 Alipay.com. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface APayAuthInfo : NSObject
12 |
13 | @property(nonatomic, copy)NSString *appID;
14 | @property(nonatomic, copy)NSString *pid;
15 | @property(nonatomic, copy)NSString *redirectUri;
16 |
17 | /**
18 | * 初始化AuthInfo
19 | *
20 | * @param appIDStr 应用ID
21 | * @param productIDStr 产品码 该商户在aboss签约的产品,用户获取pid获取的参数
22 | * @param pidStr 商户ID 可不填
23 | * @param uriStr 授权的应用回调地址 比如:alidemo://auth
24 | *
25 | * @return authinfo实例
26 | */
27 | - (id)initWithAppID:(NSString *)appIDStr
28 | pid:(NSString *)pidStr
29 | redirectUri:(NSString *)uriStr;
30 |
31 | - (NSString *)description;
32 | - (NSString *)wapDescription;
33 | @end
34 |
--------------------------------------------------------------------------------
/src/ios/lib/AlipaySDK.framework/Headers/AlipaySDK.h:
--------------------------------------------------------------------------------
1 | //
2 | // AlipaySDK.h
3 | // AlipaySDK
4 | //
5 | // Created by 方彬 on 14-4-28.
6 | // Copyright (c) 2014年 Alipay. All rights reserved.
7 | //
8 |
9 |
10 | ////////////////////////////////////////////////////////
11 | ////////////////version:2.1 motify:2014.12.24//////////
12 | ///////////////////Merry Christmas=。=//////////////////
13 | ////////////////////////////////////////////////////////
14 |
15 |
16 | #import "APayAuthInfo.h"
17 | typedef enum {
18 | ALIPAY_TIDFACTOR_IMEI,
19 | ALIPAY_TIDFACTOR_IMSI,
20 | ALIPAY_TIDFACTOR_TID,
21 | ALIPAY_TIDFACTOR_CLIENTKEY,
22 | ALIPAY_TIDFACTOR_VIMEI,
23 | ALIPAY_TIDFACTOR_VIMSI,
24 | ALIPAY_TIDFACTOR_CLIENTID,
25 | ALIPAY_TIDFACTOR_APDID,
26 | ALIPAY_TIDFACTOR_MAX
27 | } AlipayTidFactor;
28 |
29 | typedef void(^CompletionBlock)(NSDictionary *resultDic);
30 |
31 | @interface AlipaySDK : NSObject
32 |
33 | /**
34 | * 创建支付单例服务
35 | *
36 | * @return 返回单例对象
37 | */
38 | + (AlipaySDK *)defaultService;
39 |
40 | /**
41 | * 用于设置SDK使用的window,如果没有自行创建window无需设置此接口
42 | */
43 | @property (nonatomic, weak) UIWindow *targetWindow;
44 |
45 | /**
46 | * 支付接口
47 | *
48 | * @param orderStr 订单信息
49 | * @param schemeStr 调用支付的app注册在info.plist中的scheme
50 | * @param compltionBlock 支付结果回调Block,用于wap支付结果回调(非跳转钱包支付)
51 | */
52 | - (void)payOrder:(NSString *)orderStr
53 | fromScheme:(NSString *)schemeStr
54 | callback:(CompletionBlock)completionBlock;
55 |
56 | /**
57 | * 处理钱包或者独立快捷app支付跳回商户app携带的支付结果Url
58 | *
59 | * @param resultUrl 支付结果url
60 | * @param completionBlock 支付结果回调
61 | */
62 | - (void)processOrderWithPaymentResult:(NSURL *)resultUrl
63 | standbyCallback:(CompletionBlock)completionBlock;
64 |
65 |
66 |
67 | /**
68 | * 获取交易token。
69 | *
70 | * @return 交易token,若无则为空。
71 | */
72 | - (NSString *)fetchTradeToken;
73 |
74 | /**
75 | * 是否已经使用过
76 | *
77 | * @return YES为已经使用过,NO反之
78 | */
79 | - (BOOL)isLogined;
80 |
81 | /**
82 | * 当前版本号
83 | *
84 | * @return 当前版本字符串
85 | */
86 | - (NSString *)currentVersion;
87 |
88 | /**
89 | * 当前版本号
90 | *
91 | * @return tid相关信息
92 | */
93 | - (NSString*)queryTidFactor:(AlipayTidFactor)factor;
94 |
95 | /**
96 | * 測試所用,realse包无效
97 | *
98 | * @param url 测试环境
99 | */
100 | - (void)setUrl:(NSString *)url;
101 |
102 |
103 | //////////////////////////////////////////////////////////////////////////////////////////////
104 | //////////////////////////h5 拦截支付入口///////////////////////////////////////////////////////
105 | //////////////////////////////////////////////////////////////////////////////////////////////
106 |
107 | /**
108 | * url order 获取接口
109 | *
110 | * @param urlStr 拦截的 url string
111 | *
112 | * @return 获取到的url order info
113 | */
114 | - (NSString*)fetchOrderInfoFromH5PayUrl:(NSString*)urlStr;
115 |
116 |
117 | /**
118 | * url支付接口
119 | *
120 | * @param orderStr 订单信息
121 | * @param schemeStr 调用支付的app注册在info.plist中的scheme
122 | * @param compltionBlock 支付结果回调Block
123 | */
124 | - (void)payUrlOrder:(NSString *)orderStr
125 | fromScheme:(NSString *)schemeStr
126 | callback:(CompletionBlock)completionBlock;
127 |
128 |
129 | //////////////////////////////////////////////////////////////////////////////////////////////
130 | //////////////////////////授权1.0//////////////////////////////////////////////////////////////
131 | //////////////////////////////////////////////////////////////////////////////////////////////
132 |
133 | /**
134 | * 快登授权
135 | * @param authInfo 需授权信息
136 | * @param completionBlock 授权结果回调,若在授权过程中,调用方应用被系统终止,则此block无效,
137 | 需要调用方在appDelegate中调用processAuthResult:standbyCallback:方法获取授权结果
138 | */
139 | - (void)authWithInfo:(APayAuthInfo *)authInfo
140 | callback:(CompletionBlock)completionBlock;
141 |
142 |
143 | /**
144 | * 处理授权信息Url
145 | *
146 | * @param resultUrl 钱包返回的授权结果url
147 | * @param completionBlock 授权结果回调
148 | */
149 | - (void)processAuthResult:(NSURL *)resultUrl
150 | standbyCallback:(CompletionBlock)completionBlock;
151 |
152 | //////////////////////////////////////////////////////////////////////////////////////////////
153 | //////////////////////////授权2.0//////////////////////////////////////////////////////////////
154 | //////////////////////////////////////////////////////////////////////////////////////////////
155 |
156 | /**
157 | * 快登授权2.0
158 | *
159 | * @param infoStr 授权请求信息字符串
160 | * @param schemeStr 调用授权的app注册在info.plist中的scheme
161 | * @param completionBlock 授权结果回调,若在授权过程中,调用方应用被系统终止,则此block无效,
162 | 需要调用方在appDelegate中调用processAuth_V2Result:standbyCallback:方法获取授权结果
163 | */
164 | - (void)auth_V2WithInfo:(NSString *)infoStr
165 | fromScheme:(NSString *)schemeStr
166 | callback:(CompletionBlock)completionBlock;
167 |
168 | /**
169 | * 处理授权信息Url
170 | *
171 | * @param resultUrl 钱包返回的授权结果url
172 | * @param completionBlock 授权结果回调
173 | */
174 | - (void)processAuth_V2Result:(NSURL *)resultUrl
175 | standbyCallback:(CompletionBlock)completionBlock;
176 |
177 | @end
178 |
--------------------------------------------------------------------------------
/src/ios/lib/AlipaySDK.framework/Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/offbye/cordova-plugin-alipay/ba83d05c2987eb3adf3510c0e80ea9f7ce9e9d58/src/ios/lib/AlipaySDK.framework/Info.plist
--------------------------------------------------------------------------------
/src/ios/lib/AlipaySDK.framework/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/offbye/cordova-plugin-alipay/ba83d05c2987eb3adf3510c0e80ea9f7ce9e9d58/src/ios/lib/AlipaySDK.framework/en.lproj/InfoPlist.strings
--------------------------------------------------------------------------------
/www/AliPay.js:
--------------------------------------------------------------------------------
1 | var exec = require('cordova/exec');
2 |
3 | exports.pay = function (paymentInfo, successCallback, errorCallback) {
4 | if(!paymentInfo){
5 | errorCallback && errorCallback("Please enter order information");
6 | }else{
7 | exec(successCallback, errorCallback, "AliPay", "pay", [paymentInfo]);
8 | }
9 | };
10 |
--------------------------------------------------------------------------------