BuckarooClient

Ruby support for Buckaroo Payment Engine 3.0

Installation

Add this line to your application's Gemfile:

gem 'buckaroo_client'

And then execute:

$ bundle

Or install it yourself as:

$ gem install buckaroo_client

Usage

Setup

Set the following ENV vars in your application:

  • BUCKAROO_CLIENT_WEBSITEKEY: website key as generated by Buckaroo
  • BUCKAROO_CLIENT_SECRET: shared secret to digitally sign API requests
  • BUCKAROO_CLIENT_ENVIRONMENT: set this to production to create real transactions. Defaults to test.

Or alternatively, configure using a block (e.g. in a Rails initializer script):

BuckarooClient.configure do |c|
  c.websitekey = 'yourwebsitekey'
  c.secret = 'randomsharedsecretstring'
  c.environment = 'production'
end

Creating a transaction

Start by creating a base transaction:

transaction = BuckarooClient.transaction(amount: 9.99, description: 'Payment')

After that, you must select a primary service:

transaction.select_service(:pay_per_email) do |s|
  s.customeremail = '[email protected]'
  # ... and some more values
end

Optionally select additional payment services as you please:

transaction.select_additional_service(:invoice_specification) do |s|
  s.add_invoice_line(description: 'Some Product', amount: 10.00)
  s.add_total_line(description: 'Total', amount: 10.00)
end
transaction.select_additional_service(:credit_management) do |s|
  s.invoice_date = Date.current
  s.date_due = s.invoice_date.next_day(14)
end

Sending data to Buckaroo Payment Engine

Use BuckarooClient.gateway to set up Buckaroo NVP Gateway transactions:

BuckarooClient.gateway.transaction_request(transaction.gateway_attributes)

This will send a signed POST request to the Buckaroo gateway.

Known limitations

  • This gem currently only supports PayPerEmail transactions.
  • Batch file creation is experimental and cannot handle invoices with mixed numbers of invoice lines.

Contributing

  1. Fork it ( https://github.com/brightin/buckaroo_client/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request