descubraomundo/omnipay-ebanx

Ebanx driver for the Omnipay payment processing library

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

This package is auto-updated.

Last update: 2024-03-28 04:51:22 UTC


README

Ebanx gateway for the Omnipay PHP payment processing library

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

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements Pagar.Me support for Omnipay.

This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.

Install

Instal the gateway using require. Require the league/omnipay base package and this gateway.

$ composer require league/omnipay descubraomundo/omnipay-ebanx

Usage

The following gateways are provided by this package:

  • Ebanx

For general usage instructions, please see the main Omnipay repository.

Example with Credit Card

// 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";
  }

Example with 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";
  }

Test Mode

Ebanx accounts use two different endpoints for the sandbox-mode and live-mode using the same API key.

In case you want to use sandbox-mode just pass the testMode parameter when seting up the gateway:

 // 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',
  ));

Data created with sandbox-mode credentials will never hit the credit card networks and will never cost anyone money.

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you want to keep up to date with release announcements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email geeks@descubraomundo.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.