0
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.

4

1 回答 1

1

商家帐户提供商可能不支持 0.00 美元的金额。您应该满足他们以验证他们是否这样做。如果他们不这样做,您可以以 0.01 美元的价格进行授权,然后使交易无效。

处理交易不需要地址和邮政编码,但执行 AVS 需要。未能执行 AVS 可能导致交易被收取适用的最高费率。

于 2014-04-28T15:43:21.773 回答