• APIcloud微信支付和支付宝支付(方案2,主要在后台进行)


    支付宝代码

    var aliPay = api.require('aliPay');
    api.ajax({
    url: yuming+'index.php/api/Alipay/getOrder',
    method: 'post',
    data:{values: {
    'user_id':$api.getStorage('id'),'totalfee':totalfee,house_id:$api.getStorage('fid'),user_payment_type:user_payment_type,user_payment_type_id:user_payment_type_id,count:$api.dom('#num').value
    }}
    }, function(rets) {
    // alert(JSON.stringify(rets));
    aliPay.payOrder({
    orderInfo: rets.str
    }, function(ret, err) {
    if(ret.status)
    {
    $api.dom('#chongzhi2').style.display='none';
    //
    $api.setStorage('tiaoshu',0)
    api.alert({
    title: '',
    msg: '支付成功',
    buttons:[ '确定']
    },function(ret,err){
    if(ret.buttonIndex == 1){

    return;
    }
    });
    /////////
    api.ajax({
    url: yuming+ 'index.php/api/History/addHistory/',
    method: 'post',
    data:{values: {
    'house_id':$api.getStorage('fid'),'user_id':$api.getStorage('id')
    }}
    }, function(ret) {
    var jsfun = 'shuaxin();';
    api.execScript({
    name: 'root',
    frameName: 'frame3',
    script: jsfun
    });
    })

    }
    else
    {
    api.alert({
    title: '',
    msg: '付款失败',
    buttons:[ '确定']
    },function(ret,err){
    if(ret.buttonIndex == 1){

    return;
    }
    });
    jfk=0;
    $api.dom('#qrfk').innerText='确认付款'
    }
    });
    });

    微信支付代码

    var wx = api.require('wx');
    var wxPay = api.require('wxPay');
    wx.auth({
    apiKey: ''
    }, function(ret, err) {
    if (ret.status) {
    var code = ret.code;
    wx.getToken({
    apiKey: '',
    apiSecret: '',
    code: code
    }, function(ret, err) {
    if (ret.status) {
    api.ajax({
    url: yuming+'index.php/api/weixin/getOrder',
    method: 'post',
    data:{values: {
    'openid':ret.openId,'user_id':$api.getStorage('id'),'totalfee':totalfee,house_id:$api.getStorage('fid'),user_payment_type:user_payment_type,user_payment_type_id:user_payment_type_id,count:$api.dom('#num').value
    }}
    }, function(rets) {
    wxPay.payOrder({
    apiKey: rets.return.apiKey,
    orderId: rets.return.orderId,
    mchId: rets.return.mchId,
    nonceStr: rets.return.nonceStr,
    timeStamp: rets.return.timeStamp,
    package: rets.return.package,
    sign: rets.return.sign,
    }, function(ret, err) {
    if (ret.status) {
    $api.dom('#chongzhi2').style.display='none';
    //
    $api.setStorage('tiaoshu',0)
    api.alert({
    title: '',
    msg: '支付成功',
    buttons:[ '确定']
    },function(ret,err){
    if(ret.buttonIndex == 1){

    return;
    }
    });
    ///////////
    api.ajax({
    url: yuming+ 'index.php/api/History/addHistory/',
    method: 'post',
    data:{values: {
    'house_id':$api.getStorage('fid'),'user_id':$api.getStorage('id')
    }}
    }, function(ret) {
    var jsfun = 'shuaxin();';
    api.execScript({
    name: 'root',
    frameName: 'frame3',
    script: jsfun
    });
    })

    } else {
    api.alert({
    title: '',
    msg: '付款失败',
    buttons:[ '确定']
    },function(ret,err){
    if(ret.buttonIndex == 1){

    return;
    }
    });
    jfk=0;
    $api.dom('#qrfk').innerText='确认付款'
    }


    });
    });
    } else {
    api.alert({
    title: '',
    msg: '付款失败',
    buttons:[ '确定']
    },function(ret,err){
    if(ret.buttonIndex == 1){

    return;
    }
    });

    $api.dom('#qrfk').innerText='确认付款'
    }
    });
    } else {
    api.alert({
    title: '',
    msg: '付款失败',
    buttons:[ '确定']
    },function(ret,err){
    if(ret.buttonIndex == 1){

    return;
    }
    });

    $api.dom('#qrfk').innerText='确认付款'
    }
    });

    }
    }

    }
    }
    })
    })
    }
    })

  • 相关阅读:
    微信公众号图片抓取
    ArcGIS Pro SDK开发从别的收集
    ARCGIS Pro试用申请教程以及登录页面脚本错误解决办法
    ArcMap python IndentationError: unexpected indent 莫名的错误解决
    ArcGIS Python更新顺序2种方法
    ArcGIS三维模型
    三维文件格式知多少 | abc、glTF、fbx、obj、dae、stl、3ds
    ArcGIS Pro创建点场景图层包(CreatePointSceneLayerPackage)
    What is the difference between SqlCommand.CommandTimeout and SqlConnection.ConnectionTimeout?
    Reference Microsoft.SqlServer.Smo.dll
  • 原文地址:https://www.cnblogs.com/jyc226/p/8081532.html
Copyright © 2020-2023  润新知