Sha256: 4a56129ec127092793f59db00a890f9cd9f0440cf1d7c2d1510e7e37f4fb660e

Contents?: true

Size: 971 Bytes

Versions: 1

Compression:

Stored size: 971 Bytes

Contents

#
# Example 6 - How to get the currently activated payment methods.
#
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 the activated methods for this API key.
	#
	methods = mollie.methods.all

	$response.body << "Your API key has #{methods.totalCount} activated payment methods:<br>"

	methods.each { |method|
		$response.body << '<div style="line-height:40px; vertical-align:top">'
		$response.body << '<img src="' << (CGI.escapeHTML method.image.normal) << '"> '
		$response.body << (CGI.escapeHTML method.description) << ' (' << (CGI.escapeHTML method.id) << ')'
		$response.body << '</div>'
	}
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/6-list-activated-methods.rb