微信jsapi支付,V3 接口,没有使用官方的SDK;
提交的参数
{
"appid": "wxb4263b9ec123455",
"mchid": "123456",
"description": "腾讯会员",
"out_trade_no": "20220223155946",
"notify_url": "http://www.baidu.com",
"amount": {
"total": "9.90",
"currency": "CNY"
},
"payer": {
"openid": "oZe5t50zsOSVi0O2sb"
}
}
//使用的是 curl 请求的
private function sendHttpRequest($data,$url,$Authorization='')
{
$headers =array(
'Content-Type:application/json',
'Accept:application/json;',
);
$curl = curl_init ();
curl_setopt ( $curl, CURLOPT_URL, $url );
curl_setopt ( $curl, CURLOPT_SSL_VERIFYPEER, FALSE );
curl_setopt ( $curl, CURLOPT_SSL_VERIFYHOST, FALSE );
curl_setopt ( $curl, CURLOPT_POST, TRUE );
curl_setopt ( $curl, CURLOPT_POSTFIELDS,$data);
curl_setopt ( $curl, CURLOPT_TIMEOUT, 30 );
curl_setopt ($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt ($curl, CURLOPT_USERAGENT, array('User-Agent:'.$_SERVER['HTTP_USER_AGENT']));
curl_setopt($curl, CURLOPT_USERPWD, $Authorization);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); //CURLAUTH_DIGEST CURLAUTH_BASIC
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 1 );
$result = curl_exec ( $curl );
if (curl_errno ( $curl )) {
}
curl_close ( $curl );
return $result;
}
请求之后 就报错 appid 不存在,我确实是 传了值的呀,麻烦大佬们帮我瞅瞅 是不是 curl 的问题
重新看下文档 V3版 你的传数都是不对的
楼主,我也遇到这个错误,请问您的问题解决了吗?分享一下
自己打印日志比对下,你这total字段也不对啊