Sha256: ab940a6c2a9a38eadb7c378ecddcafa0b547b3526dadc29723fe3c052fb0666f

Contents?: true

Size: 956 Bytes

Versions: 1

Compression:

Stored size: 956 Bytes

Contents

#
# Example 6 - How to get the currently activated payment methods.
#
require File.expand_path "../lib/Mollie/API/Client", __dir__

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 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.0.1 examples/6-list-activated-methods.rb