ajbdev/payment-gateway-bundle

此包的最新版本(dev-master)没有可用的许可证信息。

包括与Authorize.NET AIM服务的单一连接实现

dev-master 2012-10-24 18:37 UTC

This package is not auto-updated.

Last update: 2024-09-14 13:53:57 UTC


README

包括与Authorize.NET AIM服务的单一连接实现

Authorize.net

注册测试账户以获取您的测试API登录ID和交易密钥

config.yml

payment_gateway.authorizenet:
    apiLoginId: xxxxxxxx
    transactionKey: xxxxxxxx
    postUrl: https://test.authorize.net/gateway/transact.dll

实例化

$gateway = $this->container->get('payment_gateway.authorizenet.config');

设置需求

$gateway->setAddress($address);
$gateway->setAmount($amount);
$gateway->setPaymentMethod($creditCard);
$gateway->setOrder($order);

授权或捕获

$gateway->authorize();

or

$gateway->capture();

错误检查

if ($gateway->hasErrors())
{
throw new \Exception($gateway->getErrorMessage());
}

获取响应数据

$response = $gateway->getResponse();
$transactionId = $response->getTransactionId();
$code = $response->getResponseCodeText();
$type = $response->getTransactionType());