这是我的明文,
这是我的签名,签名认证工具也通过了,body = {
"appid":"wx9523d62859372e98",
"mchid":"1691122956",
"description":"order",
"out_trade_no": "1217752501201407033233368018",
"amount":{"total" : 100,"currency" : "CNY"},
"payer":{"openid" : "ofR5a6lFB8tr4oMitsATvlKeNP0w"},
"notify_url": "https://notify.lingsuan-ai.com/notify"
}
这是我的请求体,headers = {
"Authorization": 'WECHATPAY2-SHA256-RSA2048 mchid="1691122956",nonce_str="218F59ADCFF543856F02E6490AB851D8",signature="xxx",timestamp="1727575381",serial_no="5F7D96D16E2AA401FA259A7F35E833D9F44EA915"',
"Accept": "application/json",
"Content-Type": "application/json"
}
这是header,async with httpx.AsyncClient() as client:
response = await client.post(url, json=order_json_object, headers=headers)
print(response.text)
然后请求url,报错{"code":"SIGN_ERROR","detail":{"detail":{"issue":"sign not match"},"field":"signature","location":"authorization","sign_information":{"method":"POST","sign_message_length":356,"truncated_sign_message":"POST\n/v3/pay/transactions/jsapi\n1727575381\n218F59ADCFF543856F02E6490AB851D8\n{\"appid\"\n","url":"/v3/pay/transactions/jsapi"}},"message":"签名错误,请检查后再试"}
签名工具只校验签名的方式是否正确,不校验参数的正确性。建议直接使用https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay6_0.shtml