2.0.4 • Published 6 years ago
cordova-plugin-dpwechat v2.0.4
cordova-plugin-dpwechat
A cordova plugin, a JS version of Wechat SDK
Feature
智付微信支付插件,通过此插件调用微信支付
Example
See https://github.com/scottma0211/dinpayTrip.git
Install
cordova plugin add cordova-plugin-dpwechat --variable wechatappid=YOUR_WECHAT_APPID
,(iOS only) if your cordova version <5.1.1,check the URL Type using XCode
Usage
Check if wechat is installed
Wechat.isInstalled(function (installed) {
alert("Wechat installed: " + (installed ? "Yes" : "No"));
}, function (reason) {
alert("Failed: " + reason);
});
## 注意事项
```Javascript
IOS 使用Cordova微信支付插件iOS版注意事项:
1.该插件依赖第三方库文件DPWXPayPlugin.framwork,该文件可在智付官网技术支持下载;
2.该插件依赖微信官方的一些系统库文件,并需引用OpenSDK1.8.0文件夹内所有文件
```Javascript
android 导入有智付支付提供的辅助ZFWCPay.jar包放置项目libs中,在build.gradle 进行添加引用
dependencies {
compile files('libs/ZFWCPay.jar')
}
## Send payment request
```Javascript
// Android
var params = {
token: '', // 请求智付支付服务端生成
app_id: '' // 微信应用APPID
};
Wechat.sendPaymentRequest(params, function () {
alert("Success");
}, function (reason) {
alert("Failed: " + reason);
});
// IOS
Cordova.exec(successFunction, failFunction,"Wechat", "sendPaymentRequest", [data.token]);
function successFunction(){
alert("successFunction");
}
function failFunction(){
alert("failFunction");
}
FAQ
See FAQhttps://github.com/scottma0211/dinpayTrip.git