Unofficial MultiSafePay API client for Ruby

Gem Version Build Status

Installation

By far the easiest way to install the Multisafepay API client is to install it with gem.

# Gemfile
gem "multisafepay-api-ruby"

$ gem install multisafepay-api-ruby

You may also git checkout or download all the files, and include the Multisafepay API client manually.

Getting started

Require the Multisafepay API Client. Not required when used with a Gemfile

require 'multisafepay-api-ruby'

Create an initializer and add the following line:

MultiSafePay::Client.configure do |config|
  config.api_key = '<your-api-key>'
  config.environment = :test # or :live

  # Timeouts (default - 60)
  # config.open_timeout = 60
  # config.read_timeout = 60
end

You can also include the API Key in each request you make, for instance if you are using the Connect API:

MultiSafePay::Order.get('order-id', api_key: '<your-api-key>', environment: :test)

If you need to do multiple calls with the same API Key, use the following helper:

MultiSafePay::Client.with_api_key('<your-api-key>') do
  MultiSafePay::Order.create(
    order_id:     '12345',
    amount:       1000,
    currency:     'EUR',
    description:  'My first API payment',
    redirect_url: 'https://webshop.example.org/order/12345/',
    webhook_url:  'https://webshop.example.org/multisafepay-webhook/'
  )
end

Pagination

payments = MultiSafePay::Transaction.all
payments.next
payments.previous

API documentation

If you wish to learn more about the MultiSafePay API, please visit the API Documentation.

Contributing

Feel free to contribute and make things better by opening an Issue or Pull Request.

License

View license information for the software contained in this image.

Acknowledgements

This library is heavily inspired by the Mollie API client for Ruby.