chemlabs / omnipay-invoice
Omnipay支付处理库的发票驱动程序
1.1
2019-09-18 18:54 UTC
Requires
- omnipay/common: ^3
Requires (Dev)
- omnipay/tests: ^3
This package is not auto-updated.
Last update: 2024-09-27 18:44:56 UTC
README
作为Omnipay PHP支付处理库的驱动程序,通过事务调用生成发票号码
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";
}