Ruby

Our simple, straightforward API gets you up and running quickly.

Install the gem using: gem install simplify

Alternatively the gem may be downloaded and installed directly using: gem install simplify-1.8.0.gem

Dependencies

The Ruby SDK has the following dependencies which are required by the gem.

  1. rest-client
  2. json
  3. ruby-hmac

Installing the gem automatically installs all dependencies.

Set your API Keys

After logging into your account, your API keys can be located at: Settings -> API Keys

To set your public and private API keys do the following:

Simplify::public_key = "YOUR_PUBLIC_API_KEY"
Simplify::private_key = "YOUR_PRIVATE_API_KEY"

Another option is to pass the API keys as arguments to each API invocation.

Examples

Charging a Card

You can charge a card in 2 ways. Once you have generated a card token using simplify.js, you can charge the card using the token. Alternatively, you can also charge a card by passing the card details.

For more information on the simplify.js go to Payments Form.

require 'simplify'

Simplify::public_key = "YOUR_PUBLIC_API_KEY"
Simplify::private_key = "YOUR_PRIVATE_API_KEY"

payment = Simplify::Payment.create({
    "token" => "f21da65e-f0ab-45cb-b8e6-40b493c3671f",
    "amount" => 1000,
    "currency"  => "USD",
    "description" => "Description"
})

if payment['paymentStatus'] == 'APPROVED'
    puts "Payment approved"
end
require 'simplify'

Simplify::public_key = "YOUR_PUBLIC_API_KEY"
Simplify::private_key = "YOUR_PRIVATE_API_KEY"

payment = Simplify::Payment.create({
        "card" => {
            "number" => "5555555555554444",
            "expMonth" => 11,
            "expYear" => 99,
            "cvc" => "123"
        },
        "amount" => 1000,
        "currency"  => "USD",
        "description" => "Description"
})

if payment['paymentStatus'] == 'APPROVED'
    puts "Payment approved"
end

For more examples see the API documentation or our tutorial.