授权Php简单结账表格

时间:2018-03-29 07:05:08

标签: php authorize.net

我想使用Authorize.net SDk用php实现简单的结账。我对所有可用的API感到困惑:

现在我正在使用AIM api:

$sale = new AuthorizeNetAIM;
    $sale->setFields(
        array(
            // aici
            'amount'     => $total_price,
            'card_num'   => $data['CreditCardNumber'],
            'exp_date'   => $data['ExpirationDate'],
            'tax'        => $tax,

            // Billing Information
            'zip'     => $data['Zip'],
            'country' => $data['Country'],
            'address' => $data['Address'],

            // Shipping Information
            'ship_to_first_name' => $data['CardHolder'],
            'ship_to_address'    => $data['Address'],
            'ship_to_city'       => $data['City'],
            'ship_to_company'    => 'No Comapny',
            'ship_to_country'    => $data['Country'],
            'ship_to_zip'        => $data['Zip']
      )
    );

AIM曾经在我的开发服务器上工作,但现在它返回一个错误,它无法连接到Authorize。

1 个答案:

答案 0 :(得分:0)

他们有official PHP SDK

获取 MerchantAuthenticationType

$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName("YOURLOGIN");
$merchantAuthentication->setTransactionKey("YOURKEY");

获取 SubscriptionList

$sorting = new net\authorize\api\contract\v1\ARBGetSubscriptionListSortingType();
$sorting->setOrderBy('firstName');
$sorting->setOrderDescending(false);

在此处查找更多示例:https://github.com/AuthorizeNet/sample-code-php