cancel
Showing results for 
Search instead for 
Did you mean: 

Refund payments using Authorize.net AIM API

I am trying to find a way to refund payments using Authorize.net's AIM API. I found sample code located here: https://github.com/stymiee/Authorize.Net-XML /omegle /shaglevoojio. Here is the code that I am using from the sample:

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'
    ),
));

I keep getting an error message saying that the card code is missing. Any thoughts on what is missing to allow a refund to go through?

NEW CODE:

 $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',
    ),
));

 

0 REPLIES 0