我想问下有没有Demo 呀呀呀。
我已经难道mweb_url 为什么还是显示商家参数格式有误,请联系商家解决
1. 当前调起H5支付的referer为空导致,一般是因为直接访问页面调起H5支付,请按正常流程进行页面跳转后发起支付,或自行抓包确认referer值是否为空
在手机浏览器里面的
用不了哦。求帮助,一模一样一步一来都不行呀
def wx_z(request):
total_fee = "1"
# 金额
appid = ''
mch_id = ''
body = ""
key = ''
host = ""
# 微信填写的备案域名
nonce_str = str(uuid.uuid4()).replace('-', "")[:-3]
# 生成随机字符串
notify_url = 'http://{}/wxhuidiao'.format(host) /////还有这里到底是啥呀????
# 回调函数
wap_name = '腾讯充值'
wap_name.encode('utf-8')
scene_info = """
{
"h5_info": {"type": "Wap", "wap_url": "", "wap_name": wap_name}
}
"""
out_trade_no = get_order_code()
# md5 加密生成订单编号
ip = request.META['REMOTE_ADDR']
trade_type = 'MWEB'
signA = "appid=%s&body=%s&mch_id=%s&nonce_str=%s¬ify_url=%s&out_trade_no=%s&scene_info=%s&spbill_create_ip=%s&total_fee=%s&trade_type=%s" % (
appid, body, mch_id, nonce_str, notify_url, out_trade_no, scene_info, ip, total_fee,
trade_type)
print(signA)
strSignTmp = signA + "&key=" + key
sign = get_token(strSignTmp).upper()
# 进行MD5加密
print(sign)
post_data = ""
for i in (signA + "&sign=" + sign).split("&"):
xml1 = i.split("=")[0]
xml2 = i.split("=")[1]
post_data = post_data + '<' + xml1 + '>' + xml2 + ''
post_data = post_data + ''
# 组合xml请求
print(post_data)
# post_data.encode('utf-8')
headers = {'Content-Type': 'binary'}
# 解决post_data 中文编码问题
url = "https://api.mch.weixin.qq.com/pay/unifiedorder"
res = requests.post(url, data=post_data.encode(), headers=headers, verify=False)
# 提交订单信息
# res.text.encode('utf-8')
print(res.text.encode('latin_1').decode('utf8'))
pattern = re.compile("")
prepay_id = re.compile("")
redicrt_url = pattern.findall(res.text)[0]
order_no = prepay_id.findall(res.text)[0]
return redicrt_urlqi
q
求Demo 我的框架是python Django
python开发者可以使用已经封装好的“微信支付 V3 API Python SDK”
https://github.com/minibear2021/wechatpayv3
duanshuilu点抗母的demo就有你这种情况,解决的非常完美