This library enables you to integrate EBANX with any Ruby application.

Requirements

  • Ruby >= 2.0.0
  • Bundler

Installation

Add this line to your application’s Gemfile, and bundle it:

gem 'ebanx'
$ bundle

Or install it globabally using:

$ gem install ebanx

Usage

To use the EBANX Ruby gem you need to setup your integration key.

Ebanx.tap do |e|
  e.integration_key = 'fd29a3b39d8f7bffa31cecfe895236ba5b43683e225f9d4de78ac3bdca7dfb184abfed285cc99d5b13813672e586f9cf9eb8'
  e.test_mode       = true
end

You can change the following settings:

integration_key

Your integration key. It will be different in test and production modes.

test_mode

Enable or disable the test mode. The default value is false.

To create a new API request, just call one of the following methods on the Ebanx class and supply it with the request parameters:

  • Ebanx.do_cancel
  • Ebanx.do_capture
  • Ebanx.do_direct
  • Ebanx.do_exchange
  • Ebanx.do_print
  • Ebanx.do_query
  • Ebanx.do_refund
  • Ebanx.do_refund_or_cancel
  • Ebanx.do_request
  • Ebanx.do_token
  • Ebanx.do_zipcode

do_direct command example:

require 'ebanx'

Ebanx.tap do |e|
  e.integration_key = 'fd29a3b39d8f7bffa31cecfe895236ba5b43683e225f9d4de78ac3bdca7dfb184abfed285cc99d5b13813672e586f9cf9eb8'
  e.test_mode       = true
end

response = Ebanx.do_direct({
  operation: 'request',
  mode: 'full',
  payment: {
    name: 'João da Silva',
    email: 'joao@example.com',
    currency_code: 'USD',
    amount_total: 100.00,
    merchant_payment_code: 'aca8c1d848a',
    payment_type_code: 'boleto',
    person_type: 'personal',
    document: '13326724691',
    birth_date: '01/01/1980',
    zipcode: '70000-000',
    address: 'Rua Brasil',
    street_number: '1',
    city: 'Brasília',
    state: 'DF',
    country: 'br',
    phone_number: '6130001111',
    due_date: '19/10/2016'
  }
})

Contributing

Found a bug? Want to add a new feature? Go on and send a pull request to our GitHub repository:

https://github.com/ebanx-integration/ebanx-ruby