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



我已经实现了通过信用卡处理订阅的此类,但我现在需要添加接受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 ?
                */
            )
        ),

但所需字段之间似乎存在一些差异?

在我开始讨论这个问题之前,任何建议都将不胜感激。

查看Authorize.Net的文档,这应该是有效的:

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

根据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"]:"")."'"            
    )
)

));

最新更新