zoukankan      html  css  js  c++  java
  • apiCloud 调微信支付,调支付宝支付

    data里面的参数信息,需要从后台接口中调取,点击查看微信支付详情,https://docs.apicloud.com/Client-API/Open-SDK/wxPay

    首先,需要在config.xml中配置

      <!-- 支付微信 -->
    <feature name="wxPay">
    <param name="urlScheme" value="wxd0d84bbf23b4a0e4"/>
    <param name="apiKey" value="wxd0d84bbf23b4a0e4"/>
    <param name="apiSecret" value="a354f72aa1b4c2b8eaad137ac81434cd"/>
    </feature>
     <!-- 支付支付宝 -->
      <feature name="aliPayPlus">
        <param name="urlScheme" value="AliPayPlusA000000011"/>
      </feature>
                                                        var data = {
                                                            description: ret.info.wx_pay_data.po_body,
                                                            totalFee: ret.info.wx_pay_data.po_total_fee * 100,
                                                            tradeNo: ret.info.wx_pay_data.po_order_no,
                                                            spbillCreateIP: '',
                                                            deviceInfo: '',
                                                            detail: ret.info.wx_pay_data.po_body,
                                                            attach: '',
                                                            feeType: 'CNY',
                                                            timeStart: '',
                                                            timeExpire: '',
                                                            goodsTag: '',
                                                            productId: '',
                                                        }
                                                        var wxPay = api.require('wxPay');
                                                        wxPay.config({
                                                            apiKey: '',  //
                                                            mchId: '',
                                                            partnerKey: '',
                                                            notifyUrl: $app + '/Pay/wxNotify'
                                                        }, function(ret, err) {
                                                            if (ret.status) {
                                                                wxPay.pay(data, function(ret, err) {
                                                                    if (ret.status) {
                                                                        api.alert({
                                                                            title: '系统提示',
                                                                            msg: '打赏成功',
                                                                        }, function(ret, err) {
                                                                            if (ret) {
                                                                                api.closeWin();
                                                                            }
                                                                        });
                                                                    } else {
                                                                        if (err.code == '-2') {
                                                                            api.toast({
                                                                                msg: '用户取消'
                                                                            });
                                                                        } else {
                                                                            api.toast({
                                                                                    msg: '打赏失败'
                                                                            });
                                                                        }
                                                                    }
                                                                });
                                                            } else {
                                                                api.toast({
                                                                        msg: '打赏失败'
                                                                });
                                                                api.toast({
                                        msg: '传输错误'
                                    })
                                                            }
                                                        })

    data里面的参数信息,需要从后台接口中调取,点击查看微信支付详情,https://docs.apicloud.com/Client-API/Open-SDK/wxPay

    var aliPayPlus = api.require('aliPayPlus');
                                                        aliPayPlus.payOrder({
                                                            orderInfo: ret.info.pay_url,
                                                        }, function(ret, err) {
                                                            if (ret.code == '9000') {
                                                                api.alert({
                                                                    title: '系统提示',
                                                                    msg: '打赏成功',
                                                                }, function(ret, err) {
                                                                    if (ret) {
                                                                        api.closeWin();
                                                                    }
                                                                });
                                                            } else if (ret.code == '8000') {
                                                                api.alert({
                                                                    msg: '正在处理中,支付结果未知',
                                                                    buttons: ['确定']
                                                                });
                                                            } else if (ret.code == '4000') {
                                                                $("#alert-sign-fail").show();
                                                            } else if (ret.code == '5000') {
                                                                api.alert({
                                                                    msg: '重复请求',
                                                                    buttons: ['确定']
                                                                });
                                                            } else if (ret.code == '6001') {
                                                                api.alert({
                                                                    msg: '用户中途取消支付操作',
                                                                    buttons: ['确定']
                                                                });
    
                                                            } else if (ret.code == '6002') {
                                                                api.alert({
                                                                    msg: '网络连接出错',
                                                                    buttons: ['确定']
                                                                });
    
                                                            } else if (ret.code == '6004') {
                                                                api.alert({
                                                                    msg: '支付结果未知',
                                                                    buttons: ['确定']
                                                                });
                                                            }
    
                                                        });
                                                    } else {
                                                        if (ret.info == '金额过大') {
                                                            api.toast({
                                                                    msg: '充值金额已达上限,请重新输入金额'
                                                            });
                                                        } else {
                                                            api.toast({
                                                                    msg: ret.info
                                                            });
                                                        }
                                                    }
                                                })
  • 相关阅读:
    Linux下安装Tomcat服务器
    记一次操蛋的:Could not find parameter map java.lang.Long
    在IDEA中使用MyBatis Generator逆向工程生成代码
    理解jquery的$.extend()、$.fn和$.fn.extend()
    在 Win10 系统下安装 JDK 及配置环境变量的方法
    怎样设置才能允许外网访问MySQL
    基于JavaMail的Java邮件发送:简单邮件发送Demo
    前端学习第57天 背景样式、精灵图、盒子模型布局细节、盒子模型案例、w3c主页
    前端学习第56天高级选择器、盒子模型、边界圆角、其他属性
    前端学习第55天 css三种引用、‘引用的优先级’、基本选择器、属性、display
  • 原文地址:https://www.cnblogs.com/gqx-html/p/8334211.html
Copyright © 2011-2022 走看看