Sha256: c5c36c600c69a93d7a02416bda05a2eaa43a36662551573cf4680651935c7794

Contents?: true

Size: 829 Bytes

Versions: 10

Compression:

Stored size: 829 Bytes

Contents

#
# Example 5 - How to retrieve your payments history.
#
require File.expand_path "../lib/Mollie/API/Client", File.dirname(__FILE__)

begin
  #
  # Initialize the Mollie API library with your API key.
  #
  # See: https://www.mollie.nl/beheer/account/profielen/
  #
  mollie = Mollie::API::Client.new
  mollie.setApiKey "test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM"

  #
  # Get the all payments for this API key ordered by newest.
  #
  payments = mollie.payments.all

  $response.body = "Your API key has #{payments.totalCount} payments, last #{payments.count}:<br>"

  payments.each { |payment|
    $response.body << "&euro; #{payment.amount}, status: #{CGI.escapeHTML payment.status} (#{CGI.escapeHTML payment.id})<br>"
  }
rescue Mollie::API::Exception => e
  $response.body << "API call failed: " << (CGI.escapeHTML e.message)
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mollie-api-ruby-1.4.2 examples/5-payments-history.rb
mollie-api-ruby-1.4.1 examples/5-payments-history.rb
mollie-api-ruby-1.4.0 examples/5-payments-history.rb
mollie-api-ruby-1.3.0 examples/5-payments-history.rb
mollie-api-ruby-1.2.2 examples/5-payments-history.rb
mollie-api-ruby-1.2.1 examples/5-payments-history.rb
mollie-api-ruby-1.2.0 examples/5-payments-history.rb
mollie-api-ruby-1.1.5 examples/5-payments-history.rb
mollie-api-ruby-1.1.4 examples/5-payments-history.rb
mollie-api-ruby-1.1.3 examples/5-payments-history.rb