zone/moneris-api
最新稳定版本:v1.0.0
Composer 安装命令:
composer require zone/moneris-api
包简介
Payments with Moneris
关键字:
README 文档
README
Usage
require_once 'vendor/autoload.php';
use Zone\PaymentGateway;
use Zone\PaymentGateway\Helper\CreditCard;
use Zone\PaymentGateway\Helper\Transaction;
use Zone\PaymentGateway\Integration\Moneris;
use Zone\PaymentGateway\Response\CreateCharge;
use Zone\PaymentGateway\Response\ValidateCard;
$moneris = new Moneris();
$moneris->setCredentials('store5', 'yesguy'); //this are the moneris demo credentials
$moneris->getApi()->setTestMode(true); // using test environment
$transaction = new Transaction();
$transaction->setTransactionId(sprintf("T%'.020d\n", 8));
$transaction->setTransactionDate(new DateTime('now'));
$transaction->setCurrency('CAD');
$transaction->setAmount('10.00');
$transaction->setComment('test transaction');
$card = new CreditCard();
$card->setCardNumber('4242424242424242');
$card->setCardExpiry('08', '12');
$card->setCardCVV('198');
$card->setAddress1('201');
$card->setAddress2('Michigan Ave');
$card->setCity('Montreal');
$card->setEmailAddress('test@host.com');
$card->setCountry('Canada');
$card->setZipCode('M1M1M1');
$moneris->validateCard($card, function (ValidateCard $response) use ($card, $transaction, $moneris) {
//card is valid, continue with the charge.
$moneris->createCharge($card, $transaction, function (CreateCharge $response) {
//success charge
}, function (CreateCharge $response) {
//fail charge
});
}, function (ValidateCard $response) {
//card is invalid
});
统计信息
- 总下载量: 32
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2015-09-15