Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 2支票退款问题_Php_Payment Gateway_2checkout - Fatal编程技术网

Php 2支票退款问题

Php 2支票退款问题,php,payment-gateway,2checkout,Php,Payment Gateway,2checkout,使用,我在使用他们提供的示例和我自己的凭据,通过他们的API在他们的沙箱中进行退款时遇到问题。我做错了什么?请注意,我可以在他们的沙箱中进行收费,但不能退款 <?php error_reporting(E_ALL); ini_set('display_errors','On'); header('Content-Type: text/plain'); require_once('lib/Twocheckout.php'); $sChargeID = '4093729353592';

使用,我在使用他们提供的示例和我自己的凭据,通过他们的API在他们的沙箱中进行退款时遇到问题。我做错了什么?请注意,我可以在他们的沙箱中进行收费,但不能退款

<?php

error_reporting(E_ALL);
ini_set('display_errors','On');
header('Content-Type: text/plain');

require_once('lib/Twocheckout.php');

$sChargeID = '4093729353592'; // my order ID
Twocheckout::username('USER'); // my username
Twocheckout::password('PASSWORD'); // my password
Twocheckout::sandbox(true);

Twocheckout::verifySSL(false);

$charge = Twocheckout_Sale::refund(array(
    'sale_id' => $sChargeID,
    'comment' => 'Customer decided the item did not meet expectations and it was within their refund period.',
    'category' => 2 // did not like item
));

echo "\nRESPONSE = \n";
print_r($charge);
echo "\n";

关于API退款,有几件事他们没有向2Checkout说得太清楚:

  • 他们在沙箱上的密码重置电子邮件服务不起作用。我从他们的技术支持那里得到了答案

  • 您必须进入沙盒(除非是实时的)仪表板,然后单击帐户>用户管理。你会看到一个很小的注释,上面写着:“**用户不能同时访问API和卖方区域”。您还将注意到,您自己的帐户没有API访问和API更新权限。这意味着您必须从用户管理屏幕创建另一个帐户,当您创建时,请检查管理API和API更新功能。然后,使用该用户名和密码,但使用与其他帐户相同的帐户ID。请注意,此新用户可以通过API进行退款,但不能登录到仪表板

  • 请注意,费用不使用“管理API”-他们使用一个单独的API,该API使用API键,而不是用户/通行证组合。我可以对一个API使用API键,但对另一个API必须使用受限用户/传递组合,这是毫无意义的


    正是这种圈套使得2Checkout不如Stripe吸引人,但嘿,很少有服务能像Stripe这样提供快速登录和基于代币的支付。2 Heckout是我的“第二好选择”

    谢谢,你刚刚帮我省了几个小时!
    {
       "errors" : [
          {
             "code" : "FORBIDDEN",
             "message" : "Access denied to API"
          }
       ]
    }