Skip to content

ValidateResponse_Notification

Jacob McConnell edited this page Jun 10, 2014 · 2 revisions

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 Notifcations 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"
}

Clone this wiki locally