Skip to content

Return_Check

Craig edited this page Oct 26, 2012 · 1 revision

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 request method in the TwocheckoutReturn class provides a binding to validate the MD5 hash.

##Method

###check

Use to validate the MD5 hash.

####Arguments

  • hash Parameters

  • Hash of sale params listed in the example below passed to your Approved URL.

  • string String

  • Your 2Checkout secret word.

####Returns

  • boolean Boolean
  • Returns result of validating MD5 Hash.

####Example Usage:

  post(new Route("/") {
     @Override
     public Object handle(Request request, Response response) {
         HashMap<String, String> params = new HashMap<String, String>();
         params.put("sid", request.queryParams("sid"));
         params.put("total", request.queryParams("total"));
         params.put("order_number", request.queryParams("order_number"));
         params.put("key", request.queryParams("key"));
         Boolean result = TwocheckoutReturn.check(params, "tango");
         if (result == true) {
             return "Success";
         } else {
             return "Fail";
         }
     }
  });

Clone this wiki locally