Sha256: b513188ed23c9340b7479ce3f6a2311be26ee45854b19d126a4c6143c18f7d9c
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
# # Example 2 - How to verify Mollie API Payments in a webhook. # 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" # # Retrieve the payment's current state. # payment = mollie.payments.get $request.params['id'] order_id = payment.metadata.order_id # # Update the order in the database. # database_write order_id, payment.status if payment.paid? # # At this point you'd probably want to start the process of delivering the product to the customer. # $response.body << "Paid" elsif payment.open? == false # # The payment isn't paid and isn't open anymore. We can assume it was aborted. # $response.body << "Cancelled" else $response.body << "In progress" end 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/2-webhook-verification.rb |