" dynamic="no"} Language Libraries | Developer Documentation | 2Checkout
Language

2Checkout Documentation

Notification

2Checkout’s Instant Notification Service passes messages for each sale event such as a recurring billing success or decline to a URL you specify for each message type under the Notifications area in your account. The notification method in the ValidateResponse class provides a binding to validate the MD5 hash.

Method

notification

Use to validate the MD5 hash.

Arguments

  • hash Parameters
    • Hash of sale params pass by POST to your INS script. Secret Word needs to be added to using secret key.

Returns

Returns result of validating INS message.

Example Usage:

require "sinatra"

post '/' do
 @@response = Twocheckout::ValidateResponse.notification({:sale_id => params[:sale_id], :vendor_id => 1817037, :invoice_id => params[:invoice_id], :secret => "tango", :md5_hash => params[:md5_hash]})
 @@response.inspect
end

Example Response:

{
    :code => "PASS",
    :message => "Hash Matched"
}