Sha256: dbf487821e6f1b0d76a58c4f556de7b38ccf56f6fe33606d1733bacefe8e41eb
Contents?: true
Size: 1.15 KB
Versions: 4
Compression:
Stored size: 1.15 KB
Contents
# # Example 7 - How to refund a payment programmatically. # 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.api_key = "test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" # # Retrieve the payment you want to refund from the API. # payment = mollie.payments.get "tr_47uEE1su8q" # # Refund the payment. # refund = mollie.payments_refunds.with(payment).create $response.body << "The payment #{payment.id} is now refunded.<br>" # # Retrieve refunds on a payment. # refunds = mollie.payments_refunds.with(payment).all refunds.each { |refund| $response.body << '<br> Refund date: ' << (CGI.escapeHTML refund.refunded_datetime) $response.body << '<br> Refunded: € ' << (CGI.escapeHTML refund.amount_refunded) $response.body << '<br> Remaining: € ' << (CGI.escapeHTML refund.amount_remaining) $response.body << '<br>' } rescue Mollie::API::Exception => e $response.body << "API call failed: " << (CGI.escapeHTML e.message) end
Version data entries
4 entries across 4 versions & 1 rubygems