static void Main(string[] args) { try { string url = "https://gateway.zibal.ir/v1/request"; // url Zibal.makeRequest Request = new Zibal.makeRequest(); // define Request Request.merchant = "zibal"; // String Request.orderId = "1000"; // String Request.amount = 1000; //Integer Request.callbackUrl = "http://callback.com/api"; //String Request.description = "Hello Zibal !"; // String var httpResponse = Zibal.HttpRequestToZibal(url, JsonConvert.SerializeObject(Request)); // get Response using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) // make stream reader { var responseText = streamReader.ReadToEnd(); // read Response Zibal.makeRequest_response item = JsonConvert.DeserializeObject <Zibal.makeRequest_response>(responseText); // Deserilize as response class object // you can access track id with item.trackId , result with item.result and message with item.message // in asp.net you can use Response.Redirect("https://gateway.zibal.ir/start/item.trackId"); for start gateway and redirect to third-party gateway page // also you can use Response.Redirect("https://gateway.zibal.ir/start/item.trackId/direct"); for start gateway page directly } } catch (WebException ex) { Console.WriteLine(ex.Message); // print exception error } }
static void Main(string[] args) { try { string url = "https://gateway.zibal.ir/v1/verify"; // url Zibal.verifyRequest Request = new Zibal.verifyRequest(); // define Request Request.merchant = "zibal"; // String Request.trackId = "TRACK ID IN MAKEREQUEST() RESPONSE PARAMETERS"; // String var httpResponse = Zibal.HttpRequestToZibal(url, JsonConvert.SerializeObject(Request)); // get Response using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) // make stream reader { var responseText = streamReader.ReadToEnd(); // read Response Zibal.verifyResponse item = JsonConvert.DeserializeObject <Zibal.verifyResponse>(responseText); // Deserilize as response class object // you can access paidAt time with item.paidAt , result with item.result , message with item.message , status with item.status and amount with item.amount } } catch (WebException ex) { Console.WriteLine(ex.Message); // print exception error } }