Authorize.net AIM交易

时间:2014-04-28 15:40:34

标签: php authorize.net authorize.net-arb

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);

以上是我验证信用卡(使用AIM)并在30天后创建订阅(使用ARB)的代码。我遇到的问题是尝试使用0.00作为AIM销售金额。即使我将销售更改为AUTH_ONLY,也不接受任何事情。

我认为Visa需要地址和邮政编码?是否有一些我缺少AIM所需的值来收取0.00?

注意:只要$ contractorRate的值大于0,此代码就可以运行 - 这很好,但如果承包商想要等待30天向客户收费,我不想在AIM向他们收费第一

1 个答案:

答案 0 :(得分:1)

商家帐户提供商可能不支持0.00美元的金额。你应该满足他们的要求来验证他们的确。如果他们不能以0.01美元的价格获得授权,那么之后的交易将无效。

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