Sha256: 5f129dbc2e7e96a53620582233d1182d971571654d73f553e2b567e1f6d57f72

Contents?: true

Size: 814 Bytes

Versions: 1

Compression:

Stored size: 814 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_bt7vvByF6jTcBR4dLuW66eNnHYNIJp"

	#
	# 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

1 entries across 1 versions & 1 rubygems

Version Path
mollie-api-ruby-1.1.1 examples/5-payments-history.rb