简体   繁体   English

如何使用Click Bank API发起退款

[英]How to initiate refund using click bank API

I am trying to initiate a refund using click bank api with below source code. 我正在尝试使用带有以下源代码的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;


I have used below two url for reference: 我在下面使用了两个网址作为参考:

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

After executing above code it shows a blank screen nothing is displyed, My error flag is set to 1 still no error shown. 执行上述代码后,它显示空白屏幕,没有任何显示,我的错误标志设置为1,但未显示任何错误。

After a long struggle found the solution. 经过长期的努力,找到了解决方案。 Use below code it worked for me. 使用下面的代码对我有用。

 <?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);
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM