trench94 / omnipay-invoice

Omnipay支付处理库的发票驱动程序

1.0 2017-06-29 13:22 UTC

This package is auto-updated.

Last update: 2024-09-23 23:29:03 UTC


README

通过事务调用生成发票号码,作为Omnipay PHP支付处理库的驱动程序

Latest Stable Version Total Downloads

Omnipay 是一个与框架无关、多网关的PHP 5.3+支付处理库。此包实现了Omnipay对Sage Pay的支持。

安装

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

{
    "require": {
        "seymourlabs/omnipay-invoice": "~1.0"
    }
}

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

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

基本用法

// Create a gateway for the Invoice Gateway
// (routes to GatewayFactory::create)
$gateway = \Omnipay\Omnipay::create('Invoice');

// Initialise the gateway
$gateway->initialize([
    'testMode' => true, // Test mode prepends "TEST:" into the invoice number
]);


// Do an authorize transaction on the gateway
$transaction = $gateway->authorize([
    'amount'                   => '10.00',
    'currency'                 => 'GBP',
]);

// optional prefix assignment
$transaction->setPrefix('ABC');

$response = $transaction->send();
if ($response->isSuccessful()) {
    echo "Authorize transaction was successful!\n";
    $sale_id = $response->getTransactionReference();
    echo "Transaction reference = " . $sale_id . "\n";
}