Skip to content

brightin/buckaroo_client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 transaction:

transaction = BuckarooClient.transaction(
  amount: 9.99,
  description: 'Payment',
  # ... more attributes,
  service: BuckarooClient.service(
    :pay_per_email,
    customeremail: 'example@example.com',
    # ... more attributes
  ),
  additional_services: [
    # see `BuckarooClient.service` for available additional services,
    # such as :invoice_specification and :credit_management.
  ]
)

The service and additional_services objects can be quite tricky to configure correctly. See the source code and specs for additional information.

Sending data to Buckaroo Payment Engine

Call the gateway_attributes method on your transaction instance to retrieve request parameters suitable for Buckaroo to process:

request_params = transaction.gateway_attributes

Use BuckarooClient.gateway to set up Buckaroo NVP Gateway transactions. In most cases, you probably only need gateway.transaction_request. Send the request parameters like this:

BuckarooClient.gateway.transaction_request(request_params)

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

About

Ruby support for Buckaroo Payment Engine 3.0

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages