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

2Checkout Documentation

Purchase

2Checkout returns both the buyer and a set of sale parameters including any custom parameters to the approved URL when the sale has been completed. The purchase method in the ValidateResponse class provides a binding to validate the MD5 hash.

Method

purchase

Use to validate the MD5 hash.

Arguments

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

Returns

Returns result of validating an approved URL passback.

Example Usage:

require "sinatra"

post '/' do
 @@response = Twocheckout::ValidateResponse.purchase({:sid => 1817037, :secret => "tango", :order_number => params[:order_number], :total => params[:total], :key => params[:key]})
 @@response.inspect
end

Example Response:

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