Integrating SmoovPay via .Net
Sample Codes:
if (Request.HttpMethod == "POST")
{
var secret_key = "MERCHANT SECRET KEY";
var merchant = Request.Form["merchant"];
var ref_id = Request.Form["ref_id"];
var reference_code = Request.Form["reference_code"];
var response_code = Request.Form["response_code"];
var currency = Request.Form["currency"];
var total_amount = Request.Form["total_amount"];
var signature = Request.Form["signature"];
var signature_algorithm = Request.Form["signature_algorithm"];
var dataToBeHashed = secret_key
+ merchant
+ ref_id
+ reference_code
+ response_code
+ currency
+ total_amount;
var sha1 = new SHA1CryptoServiceProvider();
var passwordBytes = Encoding.UTF8.GetBytes(dataToBeHashed);
var passwordHash = sha1.ComputeHash(passwordBytes);
var check_signature = BitConverter.ToString(passwordHash).Replace("-", string.Empty).ToLowerInvariant();
if (signature == check_signature)
{
// signature matched
// check response_code
// check if ref_id has not been marked as paid before this
// check if merchant is your merchant email
// check if total_amount and currency are correct
// process payment
}
else
{
// signature does not matched
// log for investigation
}
}