Skip to content

Notification_Check

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

##Method

###request

Use to validate the MD5 hash.

####Arguments

  • hash Parameters

  • Hash of sale params listed in the example below passed by POST to your INS URL.

  • string String

  • Your 2Checkout secret word.

####Returns

  • boolean Boolean
  • Returns result of validating MD5 Hash.

####Example Usage: (Using Spark)

  post(new Route("/") {
     @Override
     public Object handle(Request request, Response response) {
         HashMap<String, String> params = new HashMap<String, String>();
         params.put("vendor_id", request.queryParams("vendor_id"));
         params.put("invoice_id", request.queryParams("invoice_id"));
         params.put("sale_id", request.queryParams("sale_id"));
         params.put("md5_hash", request.queryParams("md5_hash"));
         Boolean result = TwocheckoutNotification.check(params, "tango");
         if (result == true) {
             return "Success";
         } else {
             return "Fail";
         }
     }
  });

Clone this wiki locally