Ruby support for Buckaroo Payment Engine 3.0
Add this line to your application's Gemfile:
gem 'buckaroo_client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install buckaroo_client
Set the following ENV
vars in your application:
BUCKAROO_CLIENT_WEBSITEKEY
: website key as generated by BuckarooBUCKAROO_CLIENT_SECRET
: shared secret to digitally sign API requestsBUCKAROO_CLIENT_ENVIRONMENT
: set this toproduction
to create real transactions. Defaults totest
.
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
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.
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.
- This gem currently only supports PayPerEmail transactions.
- Batch file creation is experimental and cannot handle invoices with mixed numbers of invoice lines.
- Fork it ( https://github.com/brightin/buckaroo_client/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request