微信小程序支付接口之Django后台
本文链接:https://blog.csdn.net/qq_41860162/article/details/89098694 Python3-django-微信小程序支付接口调用 工具类生成一系列微信官方文档需要的数据 import hashlib import datetime import xml.etree.ElementTree as ET #商户平台上设置、查询 Mch_id="商户Id" client_appid="微信小程序APPId" Mch_key="支付交易秘钥" # 生成签名的函数 def paysign(appid, body, mch_id, nonce_str, notify_url, openid, out_trade_no, spbill_create_ip, total_fee): ret = { "appid": appid, "body": body, "mch_id": mch_id, "nonce_str": nonce_str, "notify_url": notify_url, "openid": openid, "out_trade_no": out_trade_no, "spbill_create_ip": spbill_create_ip, "total_fee": total_fee, "trade_type": 'JSAPI