【问题标题】:How to initiate refund using click bank API如何使用点击银行 API 发起退款
【发布时间】:2014-07-15 07:55:22
【问题描述】:

我正在尝试使用带有以下源代码的 click bank api 发起退款。

$ch = curl_init();
$qry_str="?type=rfnd&comment=API refund check&reason=7&refundType=FULL";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.clickbank.com/rest/1.3/tickets/N5GNE72J'.$qry_str);
curl_setopt($ch, CURLOPT_HEADER, true); 
//curl_setopt($ch, CURLOPT_GET, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'GET');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/xml", "Authorization:DEV-xxxxxxxxx:API-yyyyyyyyyyyy"));
$result = curl_exec($ch);
curl_close($ch);

print $result;


我使用了以下两个网址供参考:

  1. https://api.clickbank.com/api/api_13_examples/api_example.php
  2. https://api.clickbank.com/rest/1.3/tickets

执行上述代码后,它显示一个空白屏幕,没有任何显示,我的错误标志设置为 1 仍然没有显示错误。

【问题讨论】:

    标签: php curl payment-gateway clickbank


    【解决方案1】:

    经过长时间的斗争找到了解决方案。使用下面对我有用的代码。

     <?php
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,
        "https://api.clickbank.com/rest/1.3/tickets/627JE7CZ/?type=rfnd&comment=&reason=ticket.type.refund.7&refundType=FULL");
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    /**
     * ClickBank doesn't allow POST parameters to be sent in; however, for the CURL POST to work correctly, the
     * CURL_POSTFIELDS option must be set, so we'll just set it to empty and put all our request parameters on the URL
     */
    curl_setopt($ch, CURLOPT_POSTFIELDS, "");
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        "Accept: application/xml",
        "Authorization:DEV-enter your dev key here:API-enter your clerk key here"
    ));
    $result = curl_exec($ch);
    curl_close($ch);
    ?>
    

    【讨论】:

      猜你喜欢
      • 2013-02-06
      • 1970-01-01
      • 2020-11-25
      • 1970-01-01
      • 2014-04-03
      • 2014-01-12
      • 2018-11-01
      • 2016-07-18
      • 2020-08-22
      相关资源
      最近更新 更多