descubraomundo/omnipay-ebanx

Ebanx支付处理库的驱动程序

v1.1 2019-08-27 18:15 UTC

This package is auto-updated.

Last update: 2024-08-28 05:53:01 UTC


README

Ebanx支付网关用于Omnipay PHP支付处理库

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Omnipay 是一个与框架无关的多网关支付处理库,适用于PHP 5.3+。此包实现了Omnipay对Pagar.Me的支持。

这里应该是你的描述。尽量限制为一到两段话,并可能提及你支持哪些PSRs,以避免与用户和贡献者产生任何混淆。

安装

使用require安装网关。需要require league/omnipay基本包和此网关。

$ composer require league/omnipay descubraomundo/omnipay-ebanx

用法

此包提供以下网关

  • Ebanx

有关一般用法说明,请参阅主要的 Omnipay 存储库。

使用信用卡的示例

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

  // Initialise the gateway
  $gateway->initialize(array(
      'integration_key' => 'MyApiKey',
  ));

  // Create a credit card object
  // This card can be used for testing.
  $card = new CreditCard(array(
              'firstName'    => 'Example',
              'lastName'     => 'Customer',
              //'name'         => 'Example Customer',
              'birthday'     => '1988-02-28',
              'gender'       => 'M',
              'number'       => '4242424242424242',
              'expiryMonth'  => '01',
              'expiryYear'   => '2020',
              'cvv'          => '123',
              'email'        => 'customer@example.com',
              'address1'     => 'Street name, Street number, Complementary',
              'address2'     => 'Neighborhood',
              'postcode'     => '05443100',
              'phone'        => '19 3242 8855',
  ));

  // Do an authorize transaction on the gateway
  $transaction = $gateway->authorize(array(
      'amount'           => '10.00',
      'paymentMethod'   => 'creditcard',
      'installments'     => 5,
      'documentNumber' => '246.375.149-23', // CPF or CNPJ
      'notifyUrl'     => 'http://application.com/api/',
      'card'             => $card,
      // 'cardReference'      => 'card_k5sT...',
  ));
  $response = $transaction->send();
  if ($response->isSuccessful()) {
      echo "Authorize transaction was successful!\n";
      $sale_id = $response->getTransactionReference();
      echo "Transaction reference = " . $sale_id . "\n";
  }

使用Boleto的示例

  // Create a gateway for the Ebanx Gateway
  // (routes to GatewayFactory::create)
  // Create array with customer data
  $customer = array(
              'firstName'    => 'Example',
              'lastName'     => 'Customer',,
              'email'        => 'customer@example.com',
              'address1'     => 'Street name, Street number, Complementary',
              'address2'     => 'Neighborhood',
              'postcode'     => '05443100',
              'phone'        => '19 3242 8855',
  ));

  // Create a credit card object
  // The card object is required by default to get all the customer information, even if you want to use boleto payment method.
  $card = new CreditCard(array(
              'firstName'    => 'Example',
              'lastName'     => 'Customer',
              //'name'         => 'Example Customer',
              'birthday'     => '1988-02-28',
              'gender'       => 'M',
              'number'       => '4242424242424242',
              'expiryMonth'  => '01',
              'expiryYear'   => '2020',
              'cvv'          => '123',
              'email'        => 'customer@example.com',
              'address1'     => 'Street name, Street number, Complementary',
              'address2'     => 'Neighborhood',
              'city'         => 'City',
              'state'        => 'sp',
              'country'      => 'BR',
              'postcode'     => '05443100',
              'phone'        => '19 3242 8855',
  ));

  // Do an authorize transaction on the gateway
  $transaction = $gateway->authorize(array(
      'amount'           => '10.00',
      'paymentMethod'   => 'boleto',
      'documentNumber' => '246.375.149-23', // CPF or CNPJ
      'notifyUrl'     => 'http://application.com/api/',
      'card'             => $card,
  ));

  $response = $transaction->send();
  if ($response->isSuccessful()) {
      echo "Authorize Boleto transaction was successful!\n";
      $sale_id = $response->getTransactionReference();
      $boleto = $response->getBoleto();
      echo "Boleto Url = " . $boleto['boleto_url'];
      echo "Boleto Barcode = " . $boleto['boleto_barcode'];
      echo "Boleto Expiration Date = " . $boleto['boleto_expiration_date'];
      echo "Transaction reference = " . $sale_id . "\n";
  }

测试模式

Ebanx账户使用相同的API密钥,通过两个不同的端点来区分沙盒模式和生产模式。

如果你想使用沙盒模式,请在设置网关时传递testMode参数

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

  // Initialise the gateway
  $gateway->initialize(array(
      'testMode' => true,
      'integration_key' => 'MyApiKey',
  ));

使用沙盒模式凭据创建的数据永远不会触碰到信用卡网络,也不会花费任何人的钱。

支持

如果你遇到Omnipay的一般问题,我们建议你在 Stack Overflow 上发布帖子。确保添加 omnipay 标签,以便可以轻松找到。

如果你想了解发布公告,讨论项目的想法或提出更详细的问题,还有一个你可以订阅的 邮件列表

如果你认为你找到了一个bug,请使用 GitHub问题跟踪器 报告它,或者更好的是,fork库并提交pull request。

变更日志

有关最近更改的更多信息,请参阅 CHANGELOG

测试

$ composer test

贡献

有关详细信息,请参阅 CONTRIBUTING

安全

如果你发现任何与安全相关的问题,请通过电子邮件 geeks@descubraomundo.com 联系,而不是使用问题跟踪器。

鸣谢

许可

MIT许可证(MIT)。有关更多信息,请参阅 许可文件