A ruby wrapper for the Paymill API.
Add this line to your application's Gemfile:
gem 'paymill'
And then execute:
$ bundle
Or install it yourself as:
$ gem install paymill
First configure Paymill by setting your API key:
Paymill.api_key = '123' # your private API key
or more fancy:
Paymill.configure do |config|
config.api_key = '1234'
config.timeout = 3
end
Paymill::Client.create({email: '[email protected]'})
Paymill::Client.find(id)
Paymill::Client.update(id, {email: '[email protected]'})
Paymill::Client.delete(id)
Paymill::Client.delete_all
Paymill::Client.all
Paymill::Client.count
Paymill::Client.where(email: '[email protected]').limit(2).offset(10).first
Paymill::Client.order(:description, :desc).last(3)
Paymill::Client.where(email: '@gmail.com').order(:date_created, :desc).delete_all
Use scoped, where, order, limit, offset, paginate
to build up chainable query scopes.
These methods will return a Paymill::Scope object.
Use all, each, first, last, count, total, empty? and all methods from Enumerable module on the scope to trigger a query to the Paymill API.
client = Paymill::Client.new(email: '[email protected]')
client.new? # true
client.save # create TODO: not working
client.new? # false
client.description = 'A new client'
client.save # update TODO: not working
client.delete # delete
client.subscribe!(offer_id, payment_id)
transaction = Paymill::Transaction.find('trans_1243124234')
transaction.refundable?
transaction.refund!(2000, 'Refund 20 EUR')
- Fork it
- 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 new Pull Request