按照沙盒分文档付款1.01元,应该有成功,但是提示缺少ttal_fee
发送报文
<xml>
<appid><![CDATA[wxf28fb4e97dd1e3a7]]></appid>
<body><![CDATA[喝龙井·aaa 电商 测试]]></body>
<mch_id><![CDATA[1538051411]]></mch_id>
<nonce_str><![CDATA[1762619346]]></nonce_str>
<notify_url><![CDATA[http://active.7080vip.net/payed]]></notify_url>
<openid><![CDATA[oF7XQwni7oXcEUY85_EJSF6tYs38]]></openid>
<out_trade_no><![CDATA[H_TEST_WX2019-12-22071031]]></out_trade_no>
<sign><![CDATA[3704C0A436F32C87EC7C68945B1CE4B8]]></sign>
<sign_type><![CDATA[MD5]]></sign_type>
<spbill_create_ip><![CDATA[42.100.236.129]]></spbill_create_ip>
<time_expire><![CDATA[20191223081031]]></time_expire>
<time_start><![CDATA[20191222071031]]></time_start>
<total_fee>101</total_fee>
<trade_type><![CDATA[JSAPI]]></trade_type>
</xml>
接受报文
<xml>
<trade_type><![CDATA[JSAPI]]></trade_type>
<prepay_id><![CDATA[wx20191222071032642626]]></prepay_id>
<nonce_str><![CDATA[1762619346]]></nonce_str>
<return_code><![CDATA[SUCCESS]]></return_code>
<err_code_des><![CDATA[ok]]></err_code_des>
<sign><![CDATA[9CBA32020C6E941941E24430CDE57881]]></sign>
<mch_id><![CDATA[1538051411]]></mch_id>
<return_msg><![CDATA[OK]]></return_msg>
<appid><![CDATA[wxf28fb4e97dd1e3a7]]></appid>
<device_info><![CDATA[sandbox]]></device_info>
<result_code><![CDATA[SUCCESS]]></result_code>
<err_code><![CDATA[SUCCESS]]></err_code>
</xml>
调用方法生成参数传到前端(公众号)
privatestringGetPayParapeters(WeChatPayData unifiedOrder
{
WeChatPayData jsApiParam = newWeChatPayData();
jsApiParam.SetValue("appId", unifiedOrder.GetValue("appid");
jsApiParam.SetValue("timeStamp", weChatPayApi.GenerateTimeStamp());
jsApiParam.SetValue("nonceStr", weChatPayApi.GetNonce());
jsApiParam.SetValue("package", "prepay_id=" + unifiedOrder.GetValue("prepay_id");
jsApiParam.SetValue("signType", "MD5";
jsApiParam.SetValue("paySign", jsApiParam.MakeSign(option);
string parameters = jsApiParam.ToJson();
logger.LogDebug("Get jsApiParam : " + parameters;
return parameters;
}
通过上面的发送和接受报文,应该是成功了的。为什么还会有缺少total_fee的错误提示呢
你是用的测试沙盒吗?你用正式环境测是否会报这个错误?