Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I post a json string for payment , after payment it redirects to my success page,
On my success page i need get transaction details
So as per Payment Documentation i need use json Get Method to get the transaction details , passing a code like
"https://sb-open.revenuemonster.my/v3/payment/transaction/qrcode/" + Session["QrCodeWc"].ToString() + "/transactions"


Example Link Below can see Json data on this url
https://sb-open.revenuemonster.my/v3/payment/transaction/qrcode/c6c2df354c1e5274a1adc462ffbd96b3/transactions[^]

where i put code trough Session

Now i want to know how to write code to Get method to get responses from above URL

This is document Instuction
GET Get Transactions By Code
https://sb-open.revenuemonster.my/v3/payment/transaction/qrcode/39d1f014eade17aa77fb2aaa6a4e6afb/transactions
To get all transactions under existing QR code, by passing in code in query parameter (/qrcode/.../transactions).

REQUEST

Request Parameters:

Note: No request parameter is required for this endpoint


Appreciate any help

What I have tried:

string reqUrl = "https://sb-open.revenuemonster.my/v3/payment/transaction/qrcode/" + Session["QrCodeWc"].ToString() + "/transactions";

       var httpWebRequestQR = (HttpWebRequest)WebRequest.Create(reqUrl);
        httpWebRequestQR.ContentType = "application/json";
        httpWebRequestQR.Method = "GET";
        
        using (var streamWriterQR = new
        StreamWriter(httpWebRequestQR.GetRequestStream()))
        {
            string jsonQR = new JavaScriptSerializer().Serialize(new
            {

            });

            streamWriterQR.Write(jsonQR);
        }

        var httpResponseQR = (HttpWebResponse)httpWebRequestQR.GetResponse();
        using (var streamReader = new StreamReader(httpResponseQR.GetResponseStream()))
        {
            var resultsign = streamReader.ReadToEnd();
            string jsonStringsign = resultsign;

            JsonData json = JsonMapper.ToObject(jsonStringsign);
            string tranId = json["item"]["transactionId"].ToString();
           
            
            lblMsg.Text = tranId;
        }
Posted
Updated 26-Dec-18 14:29pm
v2
Comments
Graeme_Grant 25-Dec-18 23:19pm    
We can NOT run the code here, nor are we here to debug it. If you can explain the problem in detail, then we can help. What is the response code, is it "200 ok"? If not, then what? If it is, then what data is returned?
AtulSharma609 26-Dec-18 1:12am    
My question is how to get Json string data from a URL using Get Json method in asp.net c#
Member 14100243 26-Dec-18 0:27am    
Compiler Error Message: BC30456: 'InitializeCulture' is not a member of 'ASP.minimumfacilities2_aspx'. i am not able to login in server due to this massage.
Member 14100243 26-Dec-18 0:27am    
Compiler Error Message: BC30456: 'InitializeCulture' is not a member of 'ASP.minimumfacilities2_aspx'. i am not able to login in server due to this massage.
Richard MacCutchan 26-Dec-18 3:40am    
Why have you created a new account just to post these comments?

If you have the JSON data returned, then read this article as it was written to answer Q&A questions like these: Working with JSON in C# & VB[^]
 
Share this answer
 
Comments
AtulSharma609 26-Dec-18 20:30pm    
Thanks but i was looking something else which i have solved , thanks for your help
I solved the issue, No need to add Get Streams once use Get Methods
Here are the solutions.
var httpWebRequestQR = (HttpWebRequest)WebRequest.Create(reqUrl);
httpWebRequestQR.ContentType = "application/json";
httpWebRequestQR.Method = "GET";
httpWebRequestQR.Headers.Add("Authorization", "Bearer " + accToken);
httpWebRequestQR.Headers.Add("X-Signature", signatureWc);
httpWebRequestQR.Headers.Add("X-Nonce-Str", nonce);
httpWebRequestQR.Headers.Add("X-Timestamp", timestampStr);

var httpResponseQR = (HttpWebResponse)httpWebRequestQR.GetResponse();
using (var streamReader = new StreamReader(httpResponseQR.GetResponseStream()))
{
    var resultQR = streamReader.ReadToEnd();
    string jsonStringsign = resultQR;

    JsonData json = JsonMapper.ToObject(jsonStringsign);
    string txnId = json["items"]["transactionId"].ToString();
    string storeId = json["items"]["store"]["id"].ToString();
    string curType = json["items"]["currencyType"].ToString();
    int ttfee = (int) json["items"]["order"]["amount"];
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900