0

I am new to Windows universal apps development. Now I am developing an app in which I have to integrate PayU. I tried a lot but everytime the transaction error is thrown from the server.

string temp1 = "key=xxxxxx&txnid=xxxxxx&hash=hashValue&amount=xxx&firstname=abc" + 
  "&email=a@a.com&phone=80xxxxxxxx&productinfo=xxxxxxxxxxxx" + 
  "&surl=https://www.google.com&furl=https://www.twitter.com" + 
  "&udf1=a&udf2=b&udf3=c&udf4=d&udf5=e&pg=CC&bankcode=CC" + 
  "&ccardtype=CC&ccnum=1234xxxxxxxxx&ccname=xxx&ccvv=xxx" +
  "&ccexpmon=xx&ccexpyr=xxxx";

var httpClient = new Windows.Web.Http.HttpClient();
Windows.Web.Http.HttpRequestMessage httpRequestMessage = new Windows.Web.Http.HttpRequestMessage(Windows.Web.Http.HttpMethod.Post, theUri);
Windows.Web.Http.IHttpContent content = new Windows.Web.Http.HttpStringContent(temp1, Windows.Storage.Streams.UnicodeEncoding.Utf8);
httpRequestMessage.Content = content;
try
{
    webView.NavigateWithHttpRequestMessage(httpRequestMessage);
}
catch(Exception f)
{
    new MessageDialog(f.ToString()).ShowAsync();
}

And I am creating the hashValue by using method :

 public String SampleHashMsg(String strMsg)
    {
        // Convert the message string to binary data.
        string strAlgName = HashAlgorithmNames.Sha512;
        IBuffer buffUtf8Msg = CryptographicBuffer.ConvertStringToBinary(strMsg, BinaryStringEncoding.Utf8);

        // Create a HashAlgorithmProvider object.
        HashAlgorithmProvider objAlgProv = HashAlgorithmProvider.OpenAlgorithm(strAlgName);

        // Demonstrate how to retrieve the name of the hashing algorithm.
        String strAlgNameUsed = objAlgProv.AlgorithmName;

        // Hash the message.
        IBuffer buffHash = objAlgProv.HashData(buffUtf8Msg);

        // Verify that the hash length equals the length specified for the algorithm.
        if (buffHash.Length != objAlgProv.HashLength)
        {
            throw new Exception("There was an error creating the hash");
        }

        // Convert the hash to a string (for display).
        //String strHashBase64 = CryptographicBuffer.EncodeToBase64String(buffHash);

        String strHashBase64 = CryptographicBuffer.EncodeToHexString(buffHash);
        // Return the encoded string

        return strHashBase64;
    }

I should load the request to the webview. But I am getting an error "Transaction Error" in that.

I am getting transaction error, txnid is not provided. Well at PayU side the sent hash key will be used for verify a transaction. May be my txnid and the txnid contained by hash does not match and payu server denies the transaction saying that provide txnid.

I am using Microsoft Visual Studio 2013 Universal apps for the app development.

But still I am not getting correct result. Please if anyone can help me out, then please reply immediately. Thanks in advance.

Imran
  • 11
  • 3
  • what's the error? what's the expected output? – Paolo Aug 04 '15 at 10:04
  • I am getting transaction error, txnid is not provided. Well at PayU side the sent hash key will be used for verify a transaction. May be my txnid and the txnid contained by hash does not match and payu server denies the transaction saying that provide txnid. – Imran Aug 04 '15 at 10:14
  • add all the details to the question, don't put them in the comments. have a look [here](http://stackoverflow.com/help/how-to-ask) for guidelines about writing good questions. – Paolo Aug 04 '15 at 10:24

0 Answers0