augwa/payment-gateway

此包的最新版本(1.0.1)没有提供许可证信息。

一个易于使用的类,用于与一个或多个支付网关集成

1.0.1 2015-07-06 15:28 UTC

This package is not auto-updated.

Last update: 2024-09-28 17:54:40 UTC


README

一个易于使用的类,用于与一个或多个支付网关集成

支付网关支持

  • BeanStream
  • Chase Paymentech
  • Global Payments
  • Mercury Payments
  • Moneris
  • Plug N' Pay
  • Stripe

支持的功能

  • 信用卡令牌化
  • 删除信用卡令牌
  • 信用卡收费(带/不带令牌化)
  • 撤销交易
  • 部分退货交易
  • 交易信息

示例

use Augwa\PaymentGateway;

$paymentGateway = new PaymentGateway\Integration\Stripe(true);
$paymentGateway->setCredentials(
    STRIPE_SECRET_KEY
);

$transaction = new PaymentGateway\Helper\Transaction;

$transaction->setTransactionId(time());
$transaction->setTransactionDate(new \DateTime);
$transaction->setCurrency('USD');
$transaction->setAmount('10.00');
$transaction->setComment('Test Transaction');

$paymentGateway->createCharge(
    $creditCard,
    $transaction,
    function (PaymentGateway\Response\CreateCharge $response) {
        echo sprintf("\033[0;32mYour credit card was charged for \033[1;32m$%.2f\033[0;32m with reference number: \033[1;32m%s\033[0;0m", $response->getTransaction()->getAmount(), $response->getReferenceNumber()) . PHP_EOL;
    },
    function (PaymentGateway\Response\CreateCharge $response) {
        echo sprintf("\033[0;31mOops, seems like there was a problem charging the credit card: \033[1;31m%s\033[0;0m", $response->getApiError()) . PHP_EOL;
    }
);

更多代码示例,请参阅 https://github.com/augwa/payment-gateway/example