微信支付:实现了扫码支付、app支付和回调辅助函数
按照微信支付官方SDK的PHP版本,实现了python版本
支付回调定义
@csrf_exempt
def wechat_pay_callback(request, *args, **kwargs):
req_xml_str = request.body
# 回调处理:签名验证,订单查询验证
# 返回验证结果(可作为直接返回给微信的xml)
wechatpay_qrcode_config = {
'wechatpay_appid': 'xxxxxx', # 必填,微信分配的公众账号ID
'wechatpay_key': 'xxxxxx', # 必填,appid 密钥
'wechatpay_mchid': 'xxxxxx', # 必填,微信支付分配的商户号
'wechatpay_appsecret': 'xxxxxxx',
}
# wechatpay_qrcode_config = {
# 'wechatpay_appid': 'xxxxx', # 必填,微信分配的公众账号ID
# 'wechatpay_key': 'xxxxx', # 必填,appid 密钥
# 'wechatpay_mchid': 'xxxxx', # 必填,微信支付分配的商户号
# 'wechatpay_appsecret': 'xxxxx',
# }
wxpay = WxPayBasic(conf=wechatpay_qrcode_config)
res_xml_str