Using 2Checkout's supported library for PHP, I'm having trouble doing a refund in their sandbox via their API using the example they provided and my own credentials. What am I doing wrong? Note that I can do charges just fine in their sandbox, but not refunds.
<?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";
When I dump out the CURL response, I see this:
{
"errors" : [
{
"code" : "FORBIDDEN",
"message" : "Access denied to API"
}
]
}