Giter VIP home page Giter VIP logo

mollie-api-ruby's Introduction

Mollie

Mollie API client for Ruby

Accepting iDEAL, Bancontact/Mister Cash, SOFORT Banking, Creditcard, SEPA Bank transfer, SEPA Direct debit, Bitcoin, PayPal, KBC/CBC Payment Button, Belfius Direct Net and paysafecard online payments without fixed monthly costs or any punishing registration procedures. Just use the Mollie API to receive payments directly on your website or easily refund transactions to your customers.

Requirements

To use the Mollie API client, the following things are required:

  • Get yourself a free Mollie account. No sign up costs.
  • Create a new Website profile to generate API keys (live and test mode) and setup your webhook.
  • Now you're ready to use the Mollie API client in test mode.
  • In order to accept payments in live mode, payment methods must be activated in your account. Follow a few of steps, and let us handle the rest.

Installation

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

$ gem install mollie-api-ruby

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

How to receive payments

To successfully receive a payment, these steps should be implemented:

  1. Use the Mollie API client to create a payment with the requested amount, description and optionally, a payment method. It is important to specify a unique redirect URL where the customer is supposed to return to after the payment is completed.

  2. Immediately after the payment is completed, our platform will send an asynchronous request to the configured webhook to allow the payment details to be retrieved, so you know when exactly to start processing the customer's order.

  3. The customer returns, and should be satisfied to see that the order was paid and is now being processed.

Getting started

Requiring the Mollie API Client.

require 'mollie/api/client'

Initializing the Mollie API client, and setting your API key.

mollie = Mollie::API::Client.new('test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM')

Creating a new payment.

payment = mollie.payments.create(
  amount: 10.00,
  description: 'My first API payment',
  redirect_url: 'https://webshop.example.org/order/12345/'
)

Retrieving a payment.

payment = mollie.payments.get(payment.id)

if payment.paid?
  puts 'Payment received.'
end

Refunding payments

The API also supports refunding payments. Note that there is no confirmation and that all refunds are immediate and definitive. Refunds are only supported for iDEAL, credit card and Bank Transfer payments. Other types of payments cannot be refunded through our API at the moment.

payment = mollie.payments.get(payment.id)
refund  = mollie.payments_refunds.with(payment).create

Examples

The examples require Sinatra so you will need to install that gem first. Afterwards simply run:

$ cd mollie-api-ruby
$ ruby examples/app.rb

API documentation

If you wish to learn more about our API, please visit the Mollie Developer Portal. API Documentation is available in both Dutch and English.

License

BSD (Berkeley Software Distribution) License. Copyright (c) 2014-2015, Mollie B.V.

Support

Contact: www.mollie.com โ€” [email protected] โ€” +31 20-612 88 55

Powered By Mollie

mollie-api-ruby's People

Contributors

justincase avatar benoist avatar rickwong avatar faapz avatar rogierslag avatar paetor avatar thijs-riezebeek avatar ricardodevries avatar lvgunst avatar gregbeech avatar adriaanmol avatar dandandan avatar robin-mollie avatar rogiervandenberg avatar tails avatar martyphee avatar simply-phi avatar

Watchers

Bram Bokdam avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.