Sha256: 076ad2f5dd2a1cc6165d881124944c9c6340564cc0528761d635f217a54ecce5
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
# # Example 2 - How to verify Mollie API Payments in a webhook. # 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" # # 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.1.1 | examples/2-webhook-verification.rb |