kimSlim / omnipay-merchant-warrior
此包的最新版本(0.1.2)没有可用的许可信息。
基于 https://github.com/soda-framework/omnipay-merchant-warrior 的 Merchant Warrior 支付网关的 Omnipay 包
0.1.2
2016-11-21 04:51 UTC
Requires
- guzzlehttp/guzzle: ~6.0
- omnipay/common: ^2.5
This package is not auto-updated.
Last update: 2024-09-18 19:09:11 UTC
README
Merchant Warrior API 实现
Omnipay 是一个框架无关的、多网关支付处理库。此包实现了 Merchant Warrior Direct API 的组件。
安装
Omnipay 通过 Composer 安装。要安装,只需将其添加到您的 composer.json
文件
{ "require": { "composer require kimoslim/omnipay-merchant-warrior": "dev-master" } }
基本用法
此包提供了以下网关
- Merchant warrior Direct API(以下方法已完成,但当前未测试)
- processAuth
- processCapture
- processCard
购买示例
$gateway = Omnipay::create('MerchantWarrior');
$gateway->setMerchantUUID('merchant UUID');
$gateway->setApiKey('API KEY');
$gateway->setApiPassphrase('API PASS');
$card = new CreditCard(array(
'firstName' => 'Joe',
'lastName' => 'Bloggs',
'number' => '4444333322221111',
'expiryMonth' => '01',
'expiryYear' => '2019',
'billingAddress1' => 'street',
'billingCountry' => 'AU',
'billingCity' => 'SUBURB',
'billingPostcode' => 'POSTCODE',
'billingState' => 'STATE',
'email' => 'me@emailaddress.com',
));
$purchase = [
'amount' => '1.00',
'currency' => 'AUD',
'transactionType' => 'Purchase',
'transactionId' => 'TRANSACTION ID',
'transactionProduct'=> 'Test Transaction Description',
'card' => $card
];
$request = $gateway->purchase($purchase);
$response = $request->send();
if ($response->isSuccessful()) {
// insert the transaction
$txn_id = $response->getTransactionReference();
$auth_code = $response->getAuthCode();
$message = $response->getMessage();
echo 'Payment successful: TXN ID - '.$txn_id.' auth code: '.$auth_code.' message:'.$message.PHP_EOL;
}
else
{
echo 'Credit Card Failed: '.$response->getMessage().PHP_EOL;
}
授权示例
$authorize = [
'amount' => '1.00',
'currency' => 'AUD',
'transactionType' => 'Authorize',
'transactionId' => 'TRANSACTION ID',
'transactionProduct'=> 'Test Authorisation Description',
'card' => $card
];
$request = $gateway->authorize($authorize);
$response = $request->send();
if ($response->isSuccessful()) {
// insert the transaction
$txn_id = $response->getTransactionReference();
$auth_code = $response->getAuthCode();
$message = $response->getMessage();
echo 'Payment successful: TXN ID - '.$txn_id.' auth code: '.$auth_code.' message:'.$message.PHP_EOL;
}
else
{
echo 'Credit Card Failed: '.$response->getMessage().PHP_EOL;
}
有关 Merchant Warrior API 的更多详细信息,请参阅 Merchant Warrior
有关一般用法说明,请参阅主要的 Omnipay 存储库。