合单支付json:
{"combine_appid":"wxcexxx3c66725", // //这里小程序appid ? 还是要填写 电商收付通对应的服务号的appid?
"combine_out_trade_no":"CB1586678546","combine_mchid":"1579883051","scene_info":{"device_id":"POSM1:1","payer_client_ip":"14.17.22.32"},"sub_orders":[{"mchid":"1579883051","attach":"ORD20200412102827SN000021","amount":{"total_amount":200,"currency":"CNY"},"out_trade_no":"out_trade_no1586678546","sub_mchid":"1585305101","profit_sharing":true,"description":"秋店(T)ORD:ORD20200412102827SN000021买家wx_13917355566"}],"combine_payer_info":{"openid":"ofGBt5TrGgf0HjiS4rAPFrvFNI7c"},"notify_url":"https://shop.bnbvista.com/payment/wxpayecommerce/market/notify/1585305101.php"}
返回了 prepay_id: "up_wx121602275099748db8f8e66b1471339100"
然后使用php rsa签名
public function getEncryptSHA256withRSA($str){
//$str是待加密字符串
$public_key_path = $this->mch_private_key;
$public_key = file_get_contents($public_key_path);
$encrypted = '';
if (openssl_sign($str,$encrypted,$public_key,"sha256WithRSAEncryption")) {
//base64编码
$sign = base64_encode($encrypted);
} else {
throw new Exception('encrypt failed');
}
return $sign;
}
$message = $appid."\n".
$timestamp."\n".
$nonce."\n".
$prepayid."\n";
//从小程序端发送服务端php生成签名值paysign,
appId: "wxcexxx3c66725" //传的是当前小程序的appid ,不是电商收付通的服务号appid
nonceStr: "RyTNJk6kRrJRyiRawjCZTZzwh6QPJCK7"
package: "prepay_id=up_wx121602275099748db8f8e66b1471339100"
$sign= $this->getEncryptSHA256withRSA($message);
return $sign ;
生成返回paySign:
小程序端使用以下参数和paySign,发起支付时候,跳出支付窗口时候,提示支付验证签名失败。
- appId: "wxcexxx3c66725" //传的是当前小程序的appid ,不是电商收付通的服务号appid
- nonceStr: "RyTNJk6kRrJRyiRawjCZTZzwh6QPJCK7"
- package: "prepay_id=up_wx121602275099748db8f8e66b1471339100"
- paySign: "BQ/ir0qJNUfR1Ly4VDcBMwbCa6rngwbO2Ey60SrEuxTBo1gQknII8hjWTz/AQrsbqfERnonJHZ8HCWR2RqoG6xboYkgZ4s4knajtieZH5bQFcRWL8osU98I1WTDVOHcWRcDD/cM1Dx9JW2LujBlR5tC/PRj2pXsCjQFE33maLxacVf83sCFKkn6gnUH1Ihg30CsNC8hZFvyIjirYExkmAhzaaIwQXmTXqdVWqMVwq29r0Hql+2hQ8QFnMLbVw3+vsyACLmyH7NnrXp88Hbc+4Y80wWkV4BKsPZ4CfBJH4Azkec68ZK0qcuYJL3qP5eTruMw4bsDxJI2rzctgZntpug==
- "
- signType: "RSA"
- timeStamp: "1586678546"
请问有大侠可指点下,这个流程上有什么问题吗?
RSA签名程序有问题还是参数上传递不对?
combine_appid到底填哪个?签名用那个appid?感觉是一把糊涂账啊
V3验证签名工具:
链接:https://pan.baidu.com/s/1ixOAnYyZVW13dFr0jWVpvw
提取码:wujv
已解决