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
                                                            });
                                                        }
                                                    }
                                                })
  • 相关阅读:
    2019-12-18
    java读取XML文件,及封装XML字符串
    java不用中间变量交换两个值
    oracle获取当前月的第一个星期五
    2019-10-23
    HTTP中GET请求与POST请求的区别
    Java面试题整理(转载)
    java 字节流与字符流的区别
    20190822
    C++标准库string
  • 原文地址:https://www.cnblogs.com/gqx-html/p/8334211.html
Copyright © 2011-2022 走看看