2Checkout のサポートされている PHP 用ライブラリを使用して、提供された例と自分の資格情報を使用して 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";
CURL 応答をダンプすると、次のように表示されます。
{
"errors" : [
{
"code" : "FORBIDDEN",
"message" : "Access denied to API"
}
]
}