我正在尝试找到一种使用 Authorize.net 的 AIM API 退款的方法。我在这里找到了示例代码:https ://github.com/stymiee/Authorize.Net-XML 。这是我在示例中使用的代码:
require('../../config.inc.php');
require('../../AuthnetXML.class.php');
$xml = new AuthnetXML(AUTHNET_LOGIN, AUTHNET_TRANSKEY, AuthnetXML::USE_DEVELOPMENT_SERVER);
$xml->createTransactionRequest(array(
'refId' => rand(1000000, 100000000),
'transactionRequest' => array(
'transactionType' => 'refundTransaction',
'amount' => 5,
'payment' => array(
'creditCard' => array(
'cardNumber' => 'XXXX1111',
'expirationDate' => '122016'
)
),
'authCode' => '2165668159'
),
));
我不断收到一条错误消息,提示卡代码丢失。有什么想法可以让退款通过吗?
新代码:
$xml = new AuthnetXML(AUTHNET_LOGIN, AUTHNET_TRANSKEY);
$xml->createTransactionRequest(array(
'refId' => rand(1000000, 100000000),
'transactionRequest' => array(
'transactionType' => 'refundTransaction',
'amount' => 1.00,
'payment' => array(
'creditCard' => array(
'cardNumber' => 'XXXX1014',
'expirationDate' => '122025',
)
),
'refTransId' => '4928163616',
),
));