Woocommerce PayU Biz gateway response call api setup
-
I have setup woocommerce store for one of my clients and they have chosen PayU Biz as their preferred payment gateway due to less transaction charges. So I setup WooCommerce Multi-Currency PayUBiz plugin given by PayUBiz team and they started accepting payments on their store. Now there was an issue with some transactions which were successful from PayuBiz means customer’s amount got deducted and store owner also received amount in their PayU account but the order status shows as pending payment and gets cancelled after 15mins time limit.
I talked with PayUBiz team and they told that they have a verify payment option available on woocommerce single order page through which store owner can fetch real time transaction status from their website and update the order status accordingly.
However if we want this process to be done automatically then we need to place a callcode as below in our website to fetch transaction status automatically. Below is the code<?php
// Merchant key here as provided by Payu$key = “gtKFFx”;
$salt = “eCwWELxi”;$command = ‘verify_payment’;
$var1 = ‘15749273225ddf7bda697f4’;
$hash_str = $key . ‘|’ . $command . ‘|’ . $var1 . ‘|’ . $salt ;
$hash = strtolower(hash(‘sha512’, $hash_str));
$r = array(‘key’ => $key , ‘hash’ =>$hash , ‘var1’ => $var1, ‘command’ => $command);
$qs= http_build_query($r);
$wsUrl = “https://test.payu.in/merchant/postservice.php?form=2”;
//$wsUrl = “https://info.payu.in/merchant/postservice?form=1”;
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $wsUrl);
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, $qs);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, 0);
$o = curl_exec($c);
if (curl_errno($c)) {
$sad = curl_error($c);
throw new Exception($sad);
}
curl_close($c);$valueSerialized = @unserialize($o);
if($o === ‘b:0;’ || $valueSerialized !== false) {
print_r($valueSerialized);
}
print_r($o);
?>Now I am not able to figure where I should modify this code and where should I place it so that woocommerce automatically starts using their verify payment call. Please help me with this.
Thanks
- The topic ‘Woocommerce PayU Biz gateway response call api setup’ is closed to new replies.