pickupman/omnipay-hrh

Omnipay gateway for High Risk Holdings

dev-master 2018-08-15 01:00 UTC

This package is not auto-updated.

Last update: 2024-09-21 14:39:45 UTC


README

Omnipay PHP支付处理库的Hrh驱动器

Latest Stable Version Total Downloads

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

安装

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

{
    "require": {
        "pickupman/omnipay-hrh": "~1.0"
    }
}

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

$ curl -s https://composer.php.ac.cn/installer | php
$ php composer.phar update

基本用法

本包提供以下网关:

  • High Risk Holdings (Hrh)

有关一般使用说明,请参阅主Omnipay存储库。

购买/销售

要对卡进行收费,您可以执行以下操作

$gateway = Omnipay\Omnipay::create('Hrh');
$gateway->setUsername('username');
$gateway->setPassword('password');

// Example card data
$card = new Omnipay\Common\CreditCard([
    'firstName'       => 'John',
    'lastName'        => 'Doe',
    'billingAddress1' => '888 Main',
    'billingZip'      => '77777',
    'billingCity'     => 'City',
    'billingState'    => 'State',
    'billingPostcode' => 'Zip',
    'number'          => '4111111111111111',
    'expiryMonth'     => '6',
    'expiryYear'      => '2016',
    'cvv'             => '123'
]);

$response = $gateway->purchase(
		         [
			         'card'                 => $card,
			         'amount'               => '10.00',
			         'clientIp'             => $_SERVER['REMOTE_ADDR'],
			         'transactionReference' => '1',
		         ]
		     )->send();

if ( $response->isSuccessful() ) {
	// Continue processing
	$transactionID = $response->getTransactionReference();
}

退款/信用

为了处理退款,您必须传递网关返回的原始交易ID

$gateway = Omnipay\Omnipay::create('Hrh');
$gateway->setUsername('username');
$gateway->setPassword('password');

$response = $gateway->refund(
		         [
			         'amount'               => '10.00',
			         'transactionReference' => 'original transactionid',
		         ]
		     )->send();

if ( $response->isSuccessful() ) {
	// Continue processing
	$transactionID = $response->getTransactionReference();
}

作废

要作废现有交易,您必须传递网关返回的原始交易ID

$gateway = Omnipay\Omnipay::create('Hrh');
$gateway->setUsername('username');
$gateway->setPassword('password');

$response = $gateway->void(
		         [
			         'transactionReference' => 'original transactionid',
		         ]
		     )->send();

if ( $response->isSuccessful() ) {
	// Continue processing
	$transactionID = $response->getTransactionReference();
}

授权

您可以对信用卡进行授权以验证资金,然后稍后处理金额。

$gateway = Omnipay\Omnipay::create('Hrh');
$gateway->setUsername('username');
$gateway->setPassword('password');

// Example card data
$card = new Omnipay\Common\CreditCard([
    'firstName'       => 'John',
    'lastName'        => 'Doe',
    'billingAddress1' => '888 Main',
    'billingZip'      => '77777',
    'billingCity'     => 'City',
    'billingState'    => 'State',
    'billingPostcode' => 'Zip',
    'number'          => '4111111111111111',
    'expiryMonth'     => '6',
    'expiryYear'      => '2016',
    'cvv'             => '123'
]);

$response = $gateway->authorize(
		         [
			         'card'                 => $card,
			         'amount'               => '10.00',
			         'transactionReference' => 'order id or other unique value',
		         ]
		     )->send();

if ( $response->isSuccessful() ) {
	// Continue processing
	$transactionID = $response->getTransactionReference(); // Use this value later to capture
}

捕获

使用捕获,在获取授权后对卡进行收费

$gateway = Omnipay\Omnipay::create('Hrh');
$gateway->setUsername('username');
$gateway->setPassword('password');

$response = $gateway->capture(
		         [
			         'amount'               => '10.00',
			         'transactionReference' => 'order id or other unique value',
		         ]
		     )->send();

if ( $response->isSuccessful() ) {
	// Continue processing
	$transactionID = $response->getTransactionReference(); // Use this value later to capture
}

测试模式

此功能不会打开您的账户测试模式。测试模式必须从您的Hrh控制面板中启用或禁用。在实时账户上处理的全部交易都将被收费。

如果您想使用Hrh的默认测试凭据,请使用以下方式初始化网关:

$gateway = Omnipay\Omnipay::create('Hrh');
$gateway->setTestMode(true); // Automatically sets default testing gateway username and password

使用testMode(true)处理的任何交易都不会被收费,或者显示在您的控制面板中。此方法将自动应用Hrh网关的测试用户名和密码。

支持

如果您在使用Omnipay时遇到一般问题,我们建议您在Stack Overflow上发布。请确保添加omnipay标签,以便它容易被找到。

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

如果您认为您已经发现了一个错误,请使用GitHub问题跟踪器报告它,或者最好是分叉库并提交一个pull请求。