using Newtonsoft.Json.Linq;
public static void Main()
String CurrentTimestamp = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds.ToString();
String order_id = CurrentTimestamp.Replace(".", string.Empty);
var request = (HttpWebRequest)WebRequest.Create("https://api.upayments.com/test-payment");
var postData = "merchant_id=" + Uri.EscapeDataString("1201");
postData += "&username=" + Uri.EscapeDataString("test");
postData += "&password=" + Uri.EscapeDataString("test");
postData += "&api_key=" + Uri.EscapeDataString("jtest123");
postData += "&order_id=" + Uri.EscapeDataString(order_id);
postData += "&total_price=" + Uri.EscapeDataString("1");
postData += "&success_url=" + Uri.EscapeDataString("http://example.com/success.html");
postData += "&error_url=" + Uri.EscapeDataString("http://example.com/error.html");
postData += "¬ifyURL=" + Uri.EscapeDataString("http://example.com/notifyURL.html");
var data = Encoding.ASCII.GetBytes(postData);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
using (var stream = request.GetRequestStream())
stream.Write(data, 0, data.Length);
var response = (HttpWebResponse)request.GetResponse();
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
JObject jObject = JObject.Parse(responseString);
string paymentURL = jObject["paymentURL"].ToString();
Console.WriteLine(paymentURL);