cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to refund?

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.

cyang126
Member
1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

5 REPLIES 5

anet_php_sdk-1.1.8.zip\anet_php_sdk\doc\AIM.markdown

 

there a credit() method

RaynorC1emen7
Expert

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?

 

 

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.

Thanks Mate, It also help me Alot :D

Thanks Mate, It also help me Al


@cyang126 wrote:

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.



ot
:D