# pingpp-cordova **Repository Path**: 0604hx/pingpp-cordova ## Basic Information - **Project Name**: pingpp-cordova - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-06-11 - **Last Updated**: 2020-12-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Cordova Plugin Pingpp Ping++ 是为移动端应用以及 PC 网页量身打造的下一代支付系统,通过一个 SDK 便可以同时支持移动端以及 PC 端网页的多种主流支付渠道,你只需要一次接入即可完成多个渠道的接入。 Ping++ SDK 包括 Client SDK 和 Server SDK 两部分,支持主流的七种后端开发语言,适配了 Android,iOS 和 HTML5 三种移动端平台以及 PC 端网页。 #### 支持以下渠道支付 1. 支付宝 (alipay) 2. 微信支付 (wx) 3. 银联支付(upacp) 4. QQ钱包 (qpay) 4. QQ钱包 (qpay) ## 插件安装 ```sh $ cordova plugin add https://git.coding.net/pingplusplus/pingpp-cordova.git ``` 若上述方法安装失败,可使用: ``` sh $ cordova plugin add git+https://git.coding.net/pingplusplus/pingpp-cordova.git ``` ## Ping++ 标准版使用方法 ### 使用方法 ```js /** * 调用支付 * @param charge 服务端返回的 charge * @param function 支付结果回调 (result, error) */ Pingpp.createPayment(charge, function (result, error) { alert(result); alert(error); }); // 开启debug模式 Pingpp.setDebugMode(enabled) // [true] or [false]; /** * 获取当前SDK的版本号 * @param Function successCallback (version) */ Pingpp.getVersion(function(version){ alert("当前SDK版本号是:" + version); }); ``` ### iOS 回调结果配置 在 plugin.xml 中填入自己的 url_scheme, 如: ``` xml $pingpp_url_scheme ``` #### 接收并处理交易结果 渠道为百度钱包或者渠道为支付宝但未安装支付宝钱包时,交易结果会在调起插件时的 Completion 中返回。渠道为微信、支付宝(安装了支付宝钱包)、银联或者测试模式时,请实现 UIApplicationDelegate 的 - application:openURL:xxxx: 方法: 打开 `AppDelegate.m`,添加一个函数来触发支付完成后的回调 ``` objective-c //iOS 8 及以下 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { BOOL canHandleURL = [Pingpp handleOpenURL:url withCompletion:nil]; return canHandleURL; } //iOS 9 及以上 - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { BOOL canHandleURL = [Pingpp handleOpenURL:url withCompletion:nil]; return canHandleURL; } ``` ## Ping++ UI 版使用方法 ``` js ```js /** * 调用支付 * @param charge 服务端返回的 charge * @param function 支付结果回调 (result, error) */ Pingpp.createPay(charge, function (result, error) { alert(result); alert(error); }); ``` #### 官方 SDK [pingpp-ios](https://github.com/PingPlusPlus/pingpp-ios) [pingpp-android](https://github.com/PingPlusPlus/pingpp-android) ### 问题 [问题](https://coding.net/u/pingplusplus/p/pingpp-cordova/topic) **关于如何使用 SDK 请参考 [开发者中心](https://www.pingxx.com/docs/index) **