请求数据:{"mchid":"1686022399","out_trade_no":"20240923142431232065","order_id":"o202409231551411832182491","out_refund_no":"r2024092611365718323558","refund_amount":100,"refund_from":1}
响应结果:{"errcode":9403200,"errmsg":"参数为空或非法 detail:[支付签名[pay_sig]校验失败] rid: 66f4d6da-72a6c1db-136fbf81"}
$signData = [
"mchid" => "1686022399",
"out_trade_no" => "20240923142431232065",
"order_id" => "o202409231551411832182491",
"out_refund_no" => "r2024092611365718323558",
"refund_amount" => 100,
"refund_from" => 1
];
$signData = json_encode($signData, JSON_UNESCAPED_UNICODE);
$appKey = "1OQZtyTWw94IUxhhZYPeqxcDuw8voUTN";
$pay_sig = hash_hmac('sha256', 'requestCommonPayment&' . $signData, $appKey);
就是这么写的 还是报错9403200 $postdata = []; $postdata['mchid'] = $paylog['mch_id']; $postdata['out_trade_no'] = $ordernum; $postdata['order_id'] = $paylog['transaction_id']; $postdata['out_refund_no'] = date('YmdHis').rand(1000,9999); $postdata['refund_amount'] = intval(bcmul($refundmoney, 100, 0)); $postdata['refund_from'] = 1;//退款来源,枚举值 1:人工客服退款 2:用户自己退款 3:其他 // $postdata['refund_reason'] = 0;//退款原因,枚举值 0:暂无描述 1:产品问题 2:售后问题 3:意愿问题 4:价格问题 5:其他原因 $appkey = $appinfo['wxpay_b2b_appkey']; $pay_sig = self::b2b_pay_sig('/retail/B2b/refund',jsonEncode($postdata), $appkey); $rs = curl_post($url.'&pay_sig='.$pay_sig, jsonEncode($postdata)); private function b2b_pay_sig($uri, $post_body, $appkey) { $need_sign_msg = $uri . '&' . $post_body; return hash_hmac('sha256', $need_sign_msg, $appkey); }
已处理,uri使用错误导致,感谢各位大佬的关注。