微信小程序支付 签名类型不支持

    function getSign(){    
            $stringA="appid=wx1eab284c0454ecab&body=test&device_info=1000&mch_id=1535695301&nonce_str=".nonce_str();            

        $stringSignTemp=$stringA."&key=16f2330f2934FASDFsddfasw"; //注:key为商户平台设置的密钥key
        $string = md5($stringSignTemp);    
        //签名步骤四:所有字符转为大写
        $result = strtoupper($string);
        return $result;
    }
$fee=100;
$appid="wxasdfsdaflsa";
$body="test";
$mch_id="1535695601";    
$nonce_str=random();
$notify_url="";

$out_trade_no=order_number();
$spbill_create_ip="125.216.62.121";
$total_fee=$fee*100;
$trade_type="JSAPI";
$post_xml = '<xml><appid>'.$appid.'</appid>
<body>'.$body.'</body>
<device_info>pccbshop</device_info>
<mch_id>'.$mch_id.'</mch_id>
<nonce_str>'.$nonce_str.'</nonce_str>
<notify_url>'.$notify_url.'</notify_url>
<openid>'.$openid.'</openid>
<out_trade_no>'.$out_trade_no.'</out_trade_no>
<spbill_create_ip>'.$spbill_create_ip.'</spbill_create_ip>
<total_fee>'.$total_fee.'</total_fee>
<trade_type>'.$trade_type.'</trade_type>
<sign>'.getSign().'</sign>
<sign_type>md5</sign_type>
</xml> ';
//echo getSign();

$url = 'https://api.mch.weixin.qq.com/pay/unifiedorder';
$xml = http_request($url,$post_xml);
echo $xml;exit;
阅读 2.6k
1 个回答

签名方式的值应该是 MD5 不是 md5,注意大小写。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题