支付宝:

$alipaySubmit->buildRequestParaToString($parameter);
apiready = function() {
    var aliPayPlus = api.require('aliPayPlus');
    aliPayPlus.payOrder(
        {orderInfo: '(string)'}, //PHP后端获取参数
        function(ret, err) {
            if (ret.code == '9000') {
                alert = {title: '系统提示',msg: '支付成功'}
                api.alert(alert, function(ret, err) {
                    if (ret) {
                        api.closeWin();
                        window.location.href='';
                    }
                });
                return true;
            } else if (ret.code == '8000') {
                alert = {title: '系统提示',msg: '正在处理中,支付结果未知',buttons: ['确定']}
            } else if (ret.code == '5000') {
                alert = {title: '系统提示',msg: '重复请求',buttons: ['确定']}
            } else if (ret.code == '6001') {
                alert = {title: '系统提示',msg: '用户中途取消支付操作',buttons: ['确定']}
            } else if (ret.code == '6002') {
                alert = {title: '系统提示',msg: '网络连接出错',buttons: ['确定']}
            } else if (ret.code == '6004') {
                alert = {title: '系统提示',msg: '支付结果未知',buttons: ['确定']}
            }
            api.alert(alert);
            window.history.back(-1);
        }
    );
};

微信:

$return = WxPayApi::unifiedOrder($input);
$time = time();
$result = new WxPayResults;
$result->SetData('appid',$return['appid']);
$result->SetData('partnerid',$return['mch_id']);
$result->SetData('prepayid',$return['prepay_id']);
$result->SetData('package','Sign=WXPay');
$result->SetData('noncestr',$return['nonce_str']);
$result->SetData('timestamp',$time);
$return['sign'] = $result->SetSign();
$return['time'] = $time;
apiready = function() {
    var wxPay = api.require('wxPay');
    wxPay.payOrder({
            apiKey: '$return->appid',       //后端获取参数
            orderId: '$return->prepay_id',  //后端获取参数
            mchId: '$return->mch_id',       //后端获取参数
            nonceStr: '$return->nonce_str', //后端获取参数
            timeStamp: '$return->time',     //后端获取参数
            sign: '$return->sign',          //后端获取参数
            package: '$return->package',    //后端获取参数
        }, function(ret, err) {
        if (ret.status) {
            alert = {title: '系统提示',msg: '支付成功'}
            api.alert(alert, function(ret, err) {
                if (ret) {
                    api.closeWin();
                    window.location.href='';
                }
            });
            return true;
        } else {
            alert(err.code);
        }
    });
};