mvestil/omnipay-rocketgate

RocketGate 驱动程序,用于 Omnipay 支付处理库

1.2.1 2019-09-27 08:07 UTC

This package is auto-updated.

Last update: 2024-09-27 19:32:19 UTC


README

RocketGate Gateway 的 Omnipay 驱动程序

Omnipay 是一个不依赖于框架的多网关支付处理库,适用于 PHP 5.3+。本包实现了 Omnipay 的 PaymentWall 支持。

RocketGate 是交易处理领域的行业领导者。RocketGate 的安全、容错和可靠的支付处理平台包括一系列复杂的功能,包括退单处理、风险管理、高级处理和商家支持工具。RocketGate 的平台被设计得快速、可定制,并且对我们业务合作伙伴来说是盈利的。

安装

通过 Composer 安装 Omnipay。要安装,只需将其添加到您的 composer.json 文件中

{
    "require": {
        "mvestil/omnipay-rocketgate": "~1.1"
    }
}

然后运行 composer 更新您的依赖项

$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update

基本用法

本包通过 REST API 提供以下交易

  • 卡支付
  • 令牌支付
  • 退款
  • 取消
  • 3DSecure

有关一般用法说明,请参阅主 Omnipay 存储库。在类 API 文档中也有示例。

测试模式

为了进行测试支付,您必须将此包中的 testMode 设置为 true

身份验证

要调用 RocketGate Payments API,需要商家 ID 和密码,这些将通过 RocketGate 的 PHP SDK 传递。您可以从 RocketGate 本身获取这些值,也可以在他们的管理员门户中查看。

用法

// Initialize the gateway
$gateway = Omnipay::create('RocketGate');
$gateway->initialize(array(
  'merchantID'       => 'XXXXXXXXXXXX',
  'merchantPassword' => 'XXXXXXXXXXXX',
  'testMode'         => true,
));

// Create a credit card object
$card = new CreditCard(array(
  'firstName'       => 'Example',
  'lastName'        => 'Customer',
  'number'          => '4242424242424242',
  'expiryMonth'     => '01',
  'expiryYear'      => '2032',
  'cvv'             => '123',
  'email'           => 'customer@example.com',
  'billingAddress1' => 'Consolacion, Cebu',
  'billingCountry'  => 'PH',
  'billingCity'     => 'Philippines',
  'billingPostcode' => '567278',
  'billingState'    => 'Philippines',
));

// Do a purchase transaction on the gateway
$transactorId = random_int(0, 1000000000);
$transaction = $gateway->purchase(array(
  'amount'        => '50.00',
  'currency'      => 'USD',
  'card'          => $card,
  'transactorId'  => $transactorId,
  'transactionId' => random_int(0, 1000000000),
));

$response = $transaction->send();
if ($response->isSuccessful()) {
  echo "Purchase transaction was successful!\n";
  $token = $response->getCardReference();
  echo "Card reference = " . $token . "\n";
}

// Do a token transaction on the gateway
$transaction = $gateway->purchase(array(
    'amount'        => '50.0',
    'currency'      => 'USD',
    'transactorId'  => $transactorId,
    'transactionId' => random_int(0, 1000000000),
    'cardReference' => $response->getCardReference(),
));

待办事项

  • 单元测试

支持

如果您遇到 Omnipay 的一般问题,我们建议在 Stack Overflow 上发表帖子。确保添加 omnipay 标签,以便更容易找到。

如果您想了解发布公告、讨论项目想法或提出更详细的问题,还可以订阅 邮件列表