使用John Conde的AuthnetXML类实现Auth.net eCheck

时间:2015-11-28 12:07:49

标签: php authorize.net

我已经通过信用卡实现了此类处理订阅,但我现在需要添加设施以接受eCheck的付款,但我不确定如何更改此部分代码:

        'payment' => array(
            'creditCard' => array(
                'cardNumber' => '4111111111111111',
                'expirationDate' => '2016-08'
            )
        ),

我从参考AIM指南pdf和AIM指南XML pdf中得出以下内容

        'payment' => array(
            'bankAccount' => array(     // x_method equivalent ?
                'routingNumber' => '',  // x_bank_aba_code equivalent ?
                'accountNumber' => '',  // x_bank_acct_num equivalent ?
                'nameOnAccount' => '',  // x_bank_acct_name equivalent ?
                'bankName' => '',       // x_bank_name equivalent ?
                'echeckType' => 'WEB'   // x_echeck_type equivalent
                /*
                x_bank_acct_type has no equivalent ?
                */
            )
        ),

但是必填字段之间似乎存在一些差异?

在我开始之前的任何指示都将非常感激。

2 个答案:

答案 0 :(得分:3)

查看Authorize.Net's documentation这应该有效:

    'payment' => array(
        'bankAccount' => array(     
            'accountType' => '',  // 'checking'
            'routingNumber' => '',  
            'accountNumber' => '',  
            'nameOnAccount' => '' 
        )
    ),

答案 1 :(得分:1)

继John的答案之后,这是我通过谷歌搜索找到这个问题的完整代码:

$xml->ARBCreateSubscriptionRequest(array(
'subscription' => array(
    'name' => 'SubscriptionName',
    'paymentSchedule' => array(
        'interval' => array(
            'length' => '1',
            'unit' => 'months'
        ),
        'startDate' => date('Y-m-d', time()), // Format: YYYY-MM-DD
        'totalOccurrences' => '9999' // To submit a subscription with no end date (an ongoing subscription), this field must be submitted with a value of 9999
    ),
    'amount' => $eCart1->GrandTotal(), // total monthly subscription
    'payment' => array(
        'bankAccount' => array(    
          'accountType'     => ((isset($_POST["accountType"]))?$_POST["accountType"]:""),        // options available are checking or businessChecking in this instance
          'routingNumber' => ((isset($_POST["routingNumber"]))?$_POST["routingNumber"]:""),    
          'accountNumber' => ((isset($_POST["accountNumber"]))?$_POST["accountNumber"]:""),  
          'nameOnAccount' => ((isset($_POST["nameOnAccount"]))?$_POST["nameOnAccount"]:""),
          'echeckType'      => ((isset($_POST["echeckType"]))?$_POST["echeckType"]:"")          // if businessChecking is chosen then 'CCD' else 'WEB'
        )
    ),
    'customer' => array(
      'id' => "'".$_SESSION['clientID']."'",
      'email' => "'".((isset($_POST["email"]))?$_POST["email"]:"")."'"
    ),
    'billTo' => array(
        'firstName' => "'".((isset($_POST["firstname"]))?$_POST["firstname"]:"")."'",
        'lastName' => "'".((isset($_POST["lastname"]))?$_POST["lastname"]:"")."'",
        'company' => "'".((isset($_POST["company"]))?$_POST["company"]:"")."'",
        'address' => "'".((isset($_POST["street1"]))?$_POST["street1"]:"")."'",
        'city' => "'".((isset($_POST["city"]))?$_POST["city"]:"")."'",
        'state' => "'".((isset($_POST["state_province"]))?$_POST["state_province"]:"")."'",
        'zip' => "'".((isset($_POST["postcode"]))?$_POST["postcode"]:"")."'"            
    )
)

));