We are moving from using Paypal to Autherorize.net and I am looking at the sampel AMI code using the developer account.
<?php
require_once 'AuthorizeNet.php'; // Make sure this path is correct.
$transaction = new AuthorizeNetAIM('xxxxx', 'xxxxxxxxxxxxxxxxxxxx');
$transaction->amount = '5.29';
$transaction->cust_id = '05041234';
$transaction->first_name = 'Jack';
$transaction->last_name = 'Jackson';
$transaction->address = '1234 Main St.';
$transaction->city = 'Fremont';
$transaction->state = 'CA';
$transaction->zip = '94538';
$transaction->card_num = '4007000000027';
$transaction->exp_date = '10/16';
$response = $transaction->authorizeAndCapture();
if ($response->approved) {
echo "<h1>Success! The test credit card has been charged!</h1>";
echo "Transaction ID: " . $response->transaction_id;
} else {
echo $response->error_message;
}
?>
Everything works, but how do I do a full or partial refund?
I have tried insert
$transaction->type = 'CREDIT'
$transaction->trans_id = 'xxxxxxxxxxxxx'
But it just created another transaction.
Solved! Go to Solution.
โ01-17-2014 02:50 PM
Ok, I figured out that I also need to include original transaction code as reference and the transaction need to be in 'settledSuccessfully' status in developer account or else it would not work.
โ03-24-2014 10:21 AM
anet_php_sdk-1.1.8.zip\anet_php_sdk\doc\AIM.markdown
there a credit() method
โ01-17-2014 04:11 PM
Why I am getting the following error?
I have called $response = $transaction->credit();
and set $transaction->card_num = "0027"; // dummy account
AuthorizeNet Error:
Response Code: 3
Response Subcode: 1
Response Reason Code: 6
Response Reason Text: The credit card number is invalid.
But if I change to
$transaction->card_num = "4007000000027";
then it works.
Will this happend in production environment with readl CC number?
โ03-21-2014 10:00 AM
Ok, I figured out that I also need to include original transaction code as reference and the transaction need to be in 'settledSuccessfully' status in developer account or else it would not work.
โ03-24-2014 10:21 AM
โ07-14-2020 11:19 AM
โ07-14-2020 11:19 AM