Skip to content

kiel-cristian/tbk-rails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TBK-Rails

Provides TBK integration with Rails.

Installation

Add tbk-rails and tbk to your Gemfile:

gem "tbk", :git => "https://github.com/gonzalo-bulnes/tbk.git", :branch => "server-configuration-variables"
gem 'tbk-rails', git: 'https://github.com/kiel-cristian/tbk-rails.git'

Then run bundle install to install both the tbk and tbk-rails gems.

A controller, routes, some required views and useful helpers can be generated running:

rails generate tbk_rails:install

You can choose between a minimal installation and the default installation. The last provides more elaborated views and helpers in order to help you to comply with the certification requirements (as decribed in the Transbank Manual de integración KCC 6.0).

We like Bootstrap and Font Awesome and both minimal and default generated views are bootstrap-aware (the generator won't install Bootstrap, but the views markup was written to make use of them if available).

Getting Started

Configuration

The TBK configuration is generated by the tbk_rails:install generator, however it's easy to create it by hand if necessary:

# config/initializers/tbk.rb

TBK.configure do |config|
  config.environment :test

  # Never use this file to set other than fake commerce_id and
  # commerce_key provided by [1], for production secrets, you should
  # use environment variables instead. Note that the TBK gem fully
  # supports environments variables to that usage.
  #
  #   [1]: Manual de integración KCC 6.0 Anexo A
  #
  config.commerce_id 597026007976
  # config.commerce_key SOME_RSA_KEY

  # Your server IP, port and protocol
  config.confirmation_url_ip_address '127.0.0.1'
  config.confirmation_url_port '80'
  config.confirmation_url_protocol 'http'
end

Integration with your business

In order to start the transaction, make your pay button point to webpay_pay_path (the named path was created by the tbk_rails:install generator).

<form action="<%= webpay_pay_path %>" method="POST">
  <!-- Your transaction data here (TBK_MONTO, TBK_TIPO_TRANSACCION...)
       See the Transbank Manual de integración KCC 6.0 for details. -->
  <input class="btn" type="submit" value="Pay!">
</form>

Finally, it's up to you to integrate the success and failure pages with your app. The default installation provides helpers and examples to make easier to generate the transaction information that Transbank requires to be displayed to the customer.

Credits

The generated files are widely inspired in the TBK gem example app by sagmor. Some of them use Font Awesome.

About

Provides TBK integration with Rails.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages