Laravel 5 将PayUMoney集成到Laravel 5.6中
我正在尝试将PayUMoney集成到Laravel 5.6中。根据PayUMoney重定向签出文档,需要填写表单并提交到“”(使用沙盒url进行测试)。 提交填充了必要字段的html表单成功地将我重定向到支付网关页面,效果良好。但我想在我的Laravel控制器中实现它。我做了以下工作: 我的路线是:Laravel 5 将PayUMoney集成到Laravel 5.6中,laravel-5,payment-gateway,payumoney,Laravel 5,Payment Gateway,Payumoney,我正在尝试将PayUMoney集成到Laravel 5.6中。根据PayUMoney重定向签出文档,需要填写表单并提交到“”(使用沙盒url进行测试)。 提交填充了必要字段的html表单成功地将我重定向到支付网关页面,效果良好。但我想在我的Laravel控制器中实现它。我做了以下工作: 我的路线是: Route::get('book/placeOrder', ['uses' => 'BooksController@placeOrder', 'as' => 'placeOrde
Route::get('book/placeOrder', ['uses' => 'BooksController@placeOrder', 'as' => 'placeOrder']);
Route::get('payumoney/surl', ['uses' => 'BooksController@surl', 'as' => 'payumoneysurl']);
Route::get('payumoney/furl', ['uses' => 'BooksController@furl', 'as' => 'payumoneyfurl']);
public function sendCurlPostRequest(){
//code to add order and order details go here
$salt = "[my merchant salt]";
$hash_string = '';
$hash_string .= "[hash string as per the payumoney checkout document]";
$hash_string .= $salt;
$hash = strtolower(hash('sha512', $hash_string));
$data1 = [
'key' => "[merchant key]",
'hash' => $hash,
'txnid' => "or1234txn",
'amount' => "10",
'firstname' => "[sample customer name]",
'email' => "[sample email]",
'phone' => "[sample phone number]",
'productinfo' => "book",
'surl' => "[route to success page]",
'furl' => "[route to failure page]",
'service_provider' => "payu_paisa",
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandboxsecure.payu.in/_payment",
CURLOPT_RETURNTRANSFER => false,
CURLOPT_FOLLOWLOCATION => 1,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $data1,
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
//print_r(json_decode($response));
//print_r($response);
}
BooksController中的placeOrder功能:
Route::get('book/placeOrder', ['uses' => 'BooksController@placeOrder', 'as' => 'placeOrder']);
Route::get('payumoney/surl', ['uses' => 'BooksController@surl', 'as' => 'payumoneysurl']);
Route::get('payumoney/furl', ['uses' => 'BooksController@furl', 'as' => 'payumoneyfurl']);
public function sendCurlPostRequest(){
//code to add order and order details go here
$salt = "[my merchant salt]";
$hash_string = '';
$hash_string .= "[hash string as per the payumoney checkout document]";
$hash_string .= $salt;
$hash = strtolower(hash('sha512', $hash_string));
$data1 = [
'key' => "[merchant key]",
'hash' => $hash,
'txnid' => "or1234txn",
'amount' => "10",
'firstname' => "[sample customer name]",
'email' => "[sample email]",
'phone' => "[sample phone number]",
'productinfo' => "book",
'surl' => "[route to success page]",
'furl' => "[route to failure page]",
'service_provider' => "payu_paisa",
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandboxsecure.payu.in/_payment",
CURLOPT_RETURNTRANSFER => false,
CURLOPT_FOLLOWLOCATION => 1,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $data1,
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
//print_r(json_decode($response));
//print_r($response);
}
}
单击购物车页面中的结帐按钮时,我确实会被重定向到PayUMoney页面,但该页面不会完全加载。只显示页面的html标题,并显示页面加载器。因为页面没有加载,所以我只能看到加载程序
你能帮我在我的Laravel控制器方法中实现PayUMoney支付网关(最好没有任何第三方插件)的正确方法吗
请给我指出必要的解决办法
谢谢我刚刚开始为客户使用PayU-您考虑过使用官方SDK吗 还是非正式的
谢谢你推荐我的套餐