3
Gentlemen, good night!
I’m doing an integration with pagseguro for my site.
I set the page to receive the notification whenever its status is changed according to the code below.
protected void Page_Load(object sender, EventArgs e)
{
var notificationCode = Request.QueryString["notificationCode"];
var token = "***";
var email = "********@live.com";
if (notificationCode != null)
{
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create("https://ws.pagseguro.uol.com.br/v3/transactions/notifications/" + notificationCode + "?email=" + email + "&token=" + token);
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
}
}
I make a check if there is a notification code, if there is one, it redirects to the page requesting the XML of this notification. But I think this way is not correct.
I would like a help to make a request of type GET in pagseguro, with the link, and receive this XML, besides this, save the status of the payment and the reference in any variable... (var status and var reference for example)
Status is inside the Node transaction
<transaction>
<status>3</status>
</transaction>
Somebody please help me?
Have you looked at the documentation of Pagseguro itself (https://pagseguro.uol.com.br/v2/guia-de-integracao/tutorial-da-biblioteca-pagseguro-netframework.html)? They have an API to assist in this type of situation.
– Richard Dias
This is the hard way to do it. In this answer, I teach multiple use cases involving the API. Just install the Nuget package and change the examples. If you need more help, you can reply by comment that I improve the answer.
– Leonel Sanches da Silva