mirror of
https://gitee.com/zoujingli/WeChatDeveloper.git
synced 2025-04-05 09:52:47 +08:00
Update Order.php
微信要求: 签名串一共有四行,每一行为一个参数。行尾以\n(换行符,ASCII编码值为0x0A)结束,包括最后一行。 如果最后一行没有加\n,前端调起支付时会提签名错误。
This commit is contained in:
parent
4ba213dcea
commit
d32b3ecd88
@ -60,10 +60,10 @@ class Order extends BasicWePay
|
||||
$prepayId = $result['prepay_id'];
|
||||
$nonceStr = Tools::createNoncestr();
|
||||
if ($type === 'app') {
|
||||
$sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, $prepayId]));
|
||||
$sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, $prepayId])."\n");
|
||||
return ['partnerId' => $this->config['mch_id'], 'prepayId' => $prepayId, 'package' => 'Sign=WXPay', 'nonceStr' => $nonceStr, 'timeStamp' => $time, 'sign' => $sign];
|
||||
} elseif ($type === 'jsapi') {
|
||||
$sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, "prepay_id={$prepayId}"]));
|
||||
$sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, "prepay_id={$prepayId}"])."\n");
|
||||
return ['appId' => $appid, 'timeStamp' => $time, 'nonceStr' => $nonceStr, 'package' => "prepay_id={$prepayId}", 'signType' => 'RSA', 'paySign' => $sign];
|
||||
} else {
|
||||
return $result;
|
||||
@ -103,4 +103,4 @@ class Order extends BasicWePay
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user