Closed shunhua closed 5 years ago
$config= array( //支付宝分配给开发者的应用ID 'mer_id' => 'xxxxxxxxxxxxxxxxx', //用户应用私钥(证书路径或key,请填写绝对路径) 'private_key_path' => storage_path('cert\xxx.pfx'), //支付宝公钥(证书路径或key,请填写绝对路径) 'private_key_pwd' => '111111', 'cert_dir' => storage_path(''), 'is_test' => '0', ); $unionpay = new \JiaLeo\Payment\Unionpay\WebPay($config); $pay_data = [ 'orderId' => date('YmdHis') . rand(10000, 99999), //商户订单号 'txnAmt' => 1, //支付价格(单位:分) ]; $url = $unionpay->handle($pay_data); dd($url); 返回html 提交时候报错 【Invalid request.】
= array( //支付宝分配给开发者的应用ID 'mer_id' => 'xxxxxxxxxxxxxxxxx', //用户应用私钥(证书路径或key,请填写绝对路径) 'private_key_path' => storage_path('cert\xxx.pfx'), //支付宝公钥(证书路径或key,请填写绝对路径) 'private_key_pwd' => '111111', 'cert_dir' => storage_path(''), 'is_test' => '0', ); $unionpay = new \JiaLeo\Payment\Unionpay\WebPay($config); $pay_data = [ 'orderId' => date('YmdHis') . rand(10000, 99999), //商户订单号 'txnAmt' => 1, //支付价格(单位:分) ]; $url = $unionpay->handle($pay_data); dd($url);
你需要把配置都配置好,例如证书路径,目录,商户id,私钥密码
解决了 回调地址参数缺失
$config
= array( //支付宝分配给开发者的应用ID 'mer_id' => 'xxxxxxxxxxxxxxxxx', //用户应用私钥(证书路径或key,请填写绝对路径) 'private_key_path' => storage_path('cert\xxx.pfx'), //支付宝公钥(证书路径或key,请填写绝对路径) 'private_key_pwd' => '111111', 'cert_dir' => storage_path(''), 'is_test' => '0', ); $unionpay = new \JiaLeo\Payment\Unionpay\WebPay($config); $pay_data = [ 'orderId' => date('YmdHis') . rand(10000, 99999), //商户订单号 'txnAmt' => 1, //支付价格(单位:分) ]; $url = $unionpay->handle($pay_data); dd($url);
返回html 提交时候报错 【Invalid request.】