jundelleb/laravel-usaepay

这是一个PHP库,允许您连接到USAePay网关,并运行配置需求较少的交易。

v2.1.1 2021-08-20 13:09 UTC

This package is auto-updated.

Last update: 2024-09-20 19:37:18 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

安装

使用composer安装

composer require jundelleb/laravel-usaepay

app/config/app.php中添加服务提供者

PhpUsaepay\ServiceProvider::class,

配置

现在发布配置文件到config/usaepay.php

$ php artisan vendor:publish

此包支持通过位于config/usaepay.php的配置文件进行配置

用法

USAePay的基本用法

<?php

$sourcekey = 'your_source_key';
$sourcepin = 'your_source_pin';
$sandbox = true;
$options = [
    'debug' => true,
];

$usaepay = new \PhpUsaepay\Client($sourcekey, $sourcepin, $sandbox, $options);

示例

此包负责创建ueSecurityToken

使用searchCustomerID方法查找CustNum

<?php

$custID = '21021';

$custNum = $usaepay->searchCustomerID($custID);

参考: https://wiki.usaepay.com/developer/soap-1.6/methods/searchcustomerid

使用runTransaction方法运行销售

<?php

$request = [
    'Command' => 'sale',
    'AccountHolder' => 'John Doe',
    'Details' => [
      'Description' => 'Example Transaction',
      'Amount' => '4.00',
      'Invoice' => '44539'
    ],
    'CreditCardData' => [
      'CardNumber' => '4444555566667779',
      'CardExpiration' => '0919',
      'AvsStreet' => '1234 Main Street',
      'AvsZip' => '99281',
      'CardCode' => '999'
    ]
];

$result = $usaepay->runTransaction($request);

参考: https://wiki.usaepay.com/developer/soap-1.6/methods/runtransaction

有关方法完整列表的链接: http://wiki.usaepay.com/developer/soap-1.6/Support#methods