1.如果遇到系統繁忙,請稍後再試?
答案:多半是自己參數的問題,請認真核對參數,確保,參數於官方的參數保持一致
2.wechatpay-api-v3簽名是微信分基本都會需要的驗籤,列出微信文檔需要注意的以下事項:
(1)message參數問題$method參數爲POST 或者GET請求,$body爲POST請求體的參數參數如下面片段代碼:
$c即可爲$body,請注意的$message 裏的\n,也會導致驗籤失敗
$a['out_order_no'] = $out_order_no;
$a['service_id'] = config('miniprogram.wx.service_id');;
$a['appid'] = $appId;
$c = json_encode($a);
$message = "{$method}\n".
$canonical_url."\n".
$timestamp."\n".
$nonce."\n".
$body."\n";
(2)私鑰一定是路徑的,請注意,服務器與win系統的/問題,裏面的$raw_sign參數可以設置爲空
//生成簽名
$path = Env::get('config_path').'cert/apiclient_key.pem';
openssl_sign($message, $raw_sign,openssl_pkey_get_private(file_get_contents($path)) , 'sha256