I want to redirect to payumoney gateway from my php server using curl.
I am using laravel framework and i dont want to use html/blade method to trigger payment gateway.
$posted = array();
$posted['key'] = $MERCHANT_KEY;
$posted['hash'] = $hash;
$posted['txnid'] = $txnid;
$posted['firstname'] = $firstname;
$posted['email'] = $email;
$posted['phone'] = $phone;
$posted['amount'] = $amount;
$posted['productinfo'] = $productinfo;
$posted['surl'] = $surl;
$posted['furl'] = $furl;
ini_set('display_errors', 1);
$c = curl_init();
$url = "https://test.payu.in/_payment";
curl_setopt_array($c, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => 0,
CURLOPT_FOLLOWLOCATION => 1,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $posted,
));
$response = curl_exec($c);
But this code is showing below output and thus doesn’t redirect to gateway fully
(https://phpout.com/wp-content/uploads/2023/07/WmDFS.png)
3
Answers
Redirect to the PayUmoney gateway
Or you may use:
As per this answer, you would have to analyse the response you get from the CURL request.
In order to do that, please set the
CURLOPT_RETURNTRANSFER
Based on the response, you may redirect the user to PayUMoney gateway.