phpauthorize.netauthorize.net-arb

Authorize.net AIM Transaction


require_once 'anet_php_sdk/AuthorizeNet.php'; 
    define("AUTHORIZENET_API_LOGIN_ID", $authLogin);
    define("AUTHORIZENET_TRANSACTION_KEY", $authKey);
    //Set to true for test account, set to false for real account
    define("AUTHORIZENET_SANDBOX", true);
    $sale = new AuthorizeNetAIM;
    $sale->amount = $contractorRate;
    $sale->card_num = $ccnumber;
    $sale->exp_date = $ccexpire;
    $sale->card_code = $cccvv;
    $response = $sale->authorizeAndCapture();
    //If approved, use this for getting the transaction ID.
    if ($response->approved) {
        $transaction_id = $response->transaction_id;

    //ARB creates the subscription and sets the start date 30 days from the time of submission.
    require_once 'anet_php_sdk/AuthorizeNet.php';
    define("AUTHORIZENET_API_LOGIN_ID", $authLogin);
    define("AUTHORIZENET_TRANSACTION_KEY", $authKey);
    $subscription                          = new AuthorizeNet_Subscription;
    $subscription->name                    = "PumpSpy Monitoring";
    $subscription->intervalLength          = "1";
    $subscription->intervalUnit            = "months";
    $subscription->startDate               = $subStartDate;
    $subscription->totalOccurrences        = "9999";
    $subscription->amount                  = $contractorRate;
    $subscription->creditCardCardNumber    = $ccnumber;
    $subscription->creditCardExpirationDate= $ccexpire;
    $subscription->creditCardCardCode      = $cccvv;
    $subscription->billToFirstName         = $firstname;
    $subscription->billToLastName          = $lastname;

    // Create the subscription.
    $request = new AuthorizeNetARB;
    $response = $request->createSubscription($subscription);

Above is my code for validating the credit card (using AIM) and creating the subscription 30 days later (using ARB). The issue I'm having is trying to use 0.00 for the AIM sale amount. It's not accepting anything, even if I change the sale to AUTH_ONLY.

I think Visa requires an address and zip code? Is there something I'm missing with the required values with AIM to charge 0.00?

Note: This code works as long as $contractorRate has a value above 0 - which is fine, but if the contractor wants to wait 30 days to charge the customer, I don't want to charge them with AIM at first.


Solution

  • The merchant account provider probably does not support $0.00 amounts. You should content them to verify they do. If they don't you can do an authorization for $0.01 and then void the transaction afterwards.

    Address and zip code is not required to process a transaction but is required to perform AVS. Failure to perform AVS can result in a transaction being charged the maximum rate applicable.