cancel
Showing results for 
Search instead for 
Did you mean: 

How to use AUTH_ONLY with CC method

Hello,

 

Is it necessarly that if x_type is "AUTH_ONLY" then x_method must be "ECHECK", if yes then how to implement AUTH_ONLY (x_type) with CC (x_method)

ps
Member
2 REPLIES 2
RaynorC1emen7
Expert

Maybe something like this (untested since it's adapted from my authorize and capture implementation):

 

$authorize = new AuthorizeNetAIM(
    $GLOBALS['_authorize_id'], $GLOBALS['_authorize_key']);
$authorize->setSandbox(true);
// Set to false if using production account

$fields = array(
    'first_name' => $_POST['first'],
    'last_name' => $_POST['last'],
    'company' => $_POST['company'],
    'address' => $_POST['address'],
    'city' => $_POST['city'],
    'state' => $_POST['state'],
    'zip' => $_POST['zip'],
    'country' => 'US',

    'phone' => $_POST['phone'],
    'email' => $_POST['email'],

    'customer_ip' => $_SERVER['REMOTE_ADDR'],

    'description' => "description here",
    'amount' => $amount,

    'card_num' => $_POST['card_number'],
    'exp_date' => sprintf('%02d%02d', $_POST['card_exp_month'], ($_POST['card_exp_year'] % 1000)),
    'card_code' => $_POST['card_ccv']
);
$authorize->setFields($fields);

if ($result->error || $result->{'response_code'} != 1)
    $errors[] = "Authorization declined - {$result->response_reason_text}";

else
    // do something with transaction ID so it can be captured later

 Or you can just call the authorizeOnly function directly:

 

$authorize = new AuthorizeNetAIM(
    $GLOBALS['_authorize_id'], $GLOBALS['_authorize_key']);
$authorize->setSandbox(true);
// Set to false if using production account

$result = $authorize->authorizeOnly($amount, $card_num, $exp_date);

// Process results