【问题标题】:payumoney refund api in phpphp中的payumoney退款api
【发布时间】:2017-12-23 09:54:54
【问题描述】:

在我的移动应用程序中,我已经完美地配置了 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'];

我收到了这样的回复:

Array ( [status] => -1 [rows] => 0 [message] => 出了点问题 guid 3k4pcbv6kdqf405g0lut7id32m sessionId null [结果] => [guid] => 3k4pcbv6kdqf405g0lut7id32m [sessionId] => null [errorCode] => )

谁能建议我在这里做错了什么?

【问题讨论】:

    标签: php payumoney


    【解决方案1】:

    退款 API 在测试/沙盒环境中不起作用。

    请在下方找到直播环境的退款 API:

    https://www.payumoney.com/treasury/merchant/refundPayment?merchantKey=merchantkeyvalue&paymentId=1234&refundAmount=10

    请在Params中传递Merchant Key、Payment ID和Amount,在Headers中传递Authorization Header。

    【讨论】:

      【解决方案2】:

      出了点问题... 由于 500、502、503 或 504,PayUmoney 端出现错误 根据PayUmoney API Documentation,您的应用或网站中的服务器错误。

      要了解有关这些 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

      【讨论】:

      • 使用 PayUmoney API 文档做了同样的事情。,没有运气。
      • 3) 您还需要能够在请求的标头中添加授权:
      • 检查我更新的答案并更新您的 Curl 以获得清晰的错误消息。
      猜你喜欢
      • 2016-03-13
      • 2017-07-24
      • 1970-01-01
      • 2013-12-12
      • 2017-09-29
      • 2023-04-03
      • 1970-01-01
      • 2021-10-22
      • 2013-01-13
      相关资源
      最近更新 更多