首页 文章

payumoney在PHP中退款api

提问于
浏览
0

在我的移动应用程序中,我完美地配置了payumoney并且它的工作性能很好 . 它只是一个退款的情况 . 下面是我从应用程序调用的php文件中的代码:

include('../connection.php');

$orderid="AMD197";   

$view_rs =$conn->prepare("SELECT * from tbl_payumoney_order WHERE orderid=:orderid");       

$view_rs->execute(array(':orderid'=>$orderid));                 
$vfetch=$view_rs->fetch();

$merchantId="393463"; 
$paymentId= $vfetch['paymentId'];
$refundAmount= $vfetch['amount'];
$merchantAmount= $vfetch['amount'];
$aggregatorAmount= "0";
$refundType="1";

$data_string="paymentId=".$paymentId."&refundAmount=".$refundAmount."&refundType=".$refundType."&merchantId=".$merchantId."&merchantAmount=".$merchantAmount."&aggregatorAmount=".$aggregatorAmount; 

//paymentId=123456&refundAmount=56&refundType=1&merchantId=765433&merchantAmount=6&aggregatorAmount=50 


$ch = curl_init();      
$url = "https://test.payumoney.com/payment/refund/refundPayment";   

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, true);  /* tell curl you want to post something*/
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string); /* define what you want to post*/
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); /* return the output in string format*/
$headers = array();

$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$output = curl_exec ($ch); 
$info = curl_getinfo($ch);

$data = json_decode($output, true); 

print_r($data);

$status= $data['status']; 
$message= $data['message'];
$result= $data['result'];

我收到了这样的答复:

数组([status] => -1 [行] => 0 [消息] =>出错了guid 3k4pcbv6kdqf405g0lut7id32m sessionId null [result] => [guid] => 3k4pcbv6kdqf405g0lut7id32m [sessionId] => null [errorCode] => )

任何人都可以建议我在这里做错什么吗?

1 回答

  • 0

    根据PayUmoney API Documentation,由于您的应用程序或网站中出现500,502,503或504服务器错误,PayUmoney结束时出现 Something went wrong... 错误 .

    要了解有关这些HTTP响应代码的更多信息,您需要按照以下链接:

    https://en.wikipedia.org/wiki/List_of_HTTP_status_codes

    如果出现故障,请更新您的Curl以获取更多信息,如下所示:

    $output = curl_exec($ch);
    
    if ($output === false){
        // throw new Exception('Curl error: ' . curl_error($output));
        print_r('Curl error: ' . curl_error($output));
    }
    

    如果您仍然不确定您的问题,那么最好联系PayUmoney Support Team .

相关问题