ping++支付宝支付生产环境下无法跳转
问题描述
网站支付采用的ping++支付宝支付,开发环境一切正常,登陆到阿里服务器运行也一切正常,但是推到生产环境后,用户支付时却不行,点击支付宝支付链接没有反应
也没有什么报错信息
求大神指导迷津?指点一下思路......谢谢
代码
js代码
document.getElementById('pay').addEventListener('click', function() {
var order_no = 123;
var price = $("input[name=buy_money]").val();
var buy_version = $("input[name=buy_version]").val();
var buy_num = $("input[name=buy_num]").val();
var dataForm = {'order_no': order_no, 'amount': price,
'channel': 'alipay_pc_direct',
'quantity': buy_num, 'version': buy_version};
$.ajax({
type: "POST",
cache : false,
headers: { "cache-control": "no-cache" },
dataType: "json",
url: "/admin/pay/",
data: dataForm,
success: function(response_charge) {
pingppPc.createPayment(response_charge, function(result, err) {
//处理错误信息
alert(err);
});
}
});
});
后台代码
@blue_print.route('/pay', methods=['POST'])
@blue_print.route('/pay/', methods=['POST'])
def do_charge():
u = g.user
company_id = u.company_id
user_id = u.id
# 支付宝pc支付
params = {key: value for key, value in request.form.iteritems()}
if not request.args.get("pay_again"):
order_time = time.strftime("%Y%m%d%H%M%S", time.localtime())
orderno = str(company_id) + order_time
params['order_no'] = orderno
order_version = params['version']
num = params['quantity']
amount = params['amount']
order_name = "企业版|季度"
# 将页面生成订单写入数据库
TransactionRecord.add(orderno, company_id, order_name, num, amount, order_time)
if params['channel'] == 'alipay_pc_direct':
extra = dict(success_url='/account/admin_pay_center'
)
else:
extra = dict()
params.pop('version')
params.pop('quantity')
if isinstance(params, dict):
params['app'] = dict(id='********')
params['currency'] = 'cny'
params['client_ip'] = '127.0.0.1'
params['subject'] = '管理员支付'
params['body'] = '购买付费版'
params['extra'] = extra
params['metadata'] = dict(company_id=company_id, user_id=user_id)
params['amount'] = float(params['amount'])*100
# 向ping++发起支付请求,获取ping++返回的支付凭证(Charge对象)
pingpp.api_key = '***********************'
response_charge = pingpp.Charge.create(api_key=pingpp.api_key, **params)
# 将支付凭证回传给前端,用于页面调用支付控件
return Response(json.dumps(response_charge),
mimetype='application/json, charset=UTF-8')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论