1
Integrating PayU Biz payment gateway in MVC using AJAX and jQuery involves the following steps:
-
Create a form with the necessary details like amount, order ID, etc., and submit the form to PayU Biz's payment gateway.
-
Capture the response from PayU Biz's payment gateway, and display the response to the user.
Here is a sample code snippet that demonstrates how to integrate PayU Biz in MVC using AJAX and jQuery:
<form id="payubiz-form" action="<%=PAYU_BASE_URL%>" method="POST">
<input type="hidden" name="key" value="<%=MERCHANT_KEY%>" />
<input type="hidden" name="txnid" value="<%=order.Id%>" />
<input type="hidden" name="amount" value="<%=order.Amount%>" />
<input type="hidden" name="productinfo" value="<%=order.ProductInfo%>" />
<input type="hidden" name="firstname" value="<%=order.FirstName%>" />
<input type="hidden" name="email" value="<%=order.Email%>" />
<input type="hidden" name="phone" value="<%=order.Phone%>" />
<input type="hidden" name="surl" value="<%=order.SuccessUrl%>" />
<input type="hidden" name="furl" value="<%=order.FailureUrl%>" />
<input type="hidden" name="service_provider" value="payu_paisa" />
<input type="hidden" name="hash" value="<%=order.Hash%>" />
<input type="submit" value="Pay" />
</form>
<script type="text/javascript">
$(document).ready(function () {
$('#payubiz-form').submit(function (e) {
e.preventDefault();
$.ajax({
type: 'POST',
url: '<%=PAYU_BASE_URL%>',
data: $('#payubiz-form').serialize(),
success: function (response) {
// Handle the response from PayU Biz's payment gateway
}
});
});
});
</script>
<configuration>
<appSettings>
<add key="MERCHANT_KEY" value="your_merchant_key_here" />
<add key="PAYU_BASE_URL" value="https://test.payu.in/_payment" />
<add key="getTrSt" value="http://test.payu.in/merchant/postservice.php?form=2" />
<add key="hashSequence" value="key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||your_salt_here" />
</appSettings>
</configuration>

Accepted 1
It seems like you are facing an issue with the hash generation while integrating the PayU Biz payment gateway. Here are some steps you can follow to resolve this issue:
-
Make sure that you have entered the correct merchant key and salt in the web.config file.
-
Check if the PayU Biz credentials you are using are for the test environment or the live environment. If you are testing, use the test credentials, and if you are ready for production, use the live credentials.
-
Verify if the hash generation logic is correct. You can use the following code to generate the hash:
public static string GenerateHash(string text, string key)
{
byte[] messageBytes = Encoding.UTF8.GetBytes(text);
byte[] keyBytes = Encoding.UTF8.GetBytes(key);
string hashString = "";
using (HMACSHA512 hmac = new HMACSHA512(keyBytes))
{
byte[] hashBytes = hmac.ComputeHash(messageBytes);
hashString = BitConverter.ToString(hashBytes).Replace("-", "").ToLower();
}
return hashString;
}
-
Make sure that you are passing all the required parameters for hash generation in the correct order. The hashSequence in the web.config file defines the order of the parameters for hash generation. Double-check that you have all the parameters in the correct order.
-
If the above steps do not resolve the issue, you can contact the PayU Biz support team for further assistance.
-
I hope this helps!

1
thank u....@Rajkiran Swain
for testing purpose i used this
<add key="MERCHANT_KEY" value="gtKFFx" />
<add key="SALT" value="eCwWELxi" />
<add key="getTrSt" value="https://test.payu.in/merchant/postservice.php?form=2" />
<add key="PAYU_BASE_URL" value="https://test.payu.in/_payment" />
<add key="action" value="" />
<add key="hashSequence" value="key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10" />
but this is not work for me
