2015-07-10 63 views
0

我試圖計算支付新支付API的JSON請求的格式。該文件是有限的,我沒有支付寶賬戶,我請求演示。有人可以建議資源ID應該是什麼?請檢查請求,看看它是否正確。支付點新Api支付請求解析

var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://api.mite.paypoint.net:2443/acceptor/rest/transactions/{instId}/{resourceId}/action"); 
      httpWebRequest.ContentType = "text/json"; 
      httpWebRequest.Method = "POST"; 

      using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) 
      { 

       string json = "{\"transaction\": {" + 
           "\"currency\": \"GBP\"," + 
           "\"amount\": \"1000.0\"," + 
           "\"description\": \"Example\"," + 
           "\"merchantRef\": \"mer_txn_1234557\"," + 
           "\"commerceType\": \"MOTO\" }}"; 

       streamWriter.Write(json); 
       streamWriter.Flush(); 
       streamWriter.Close(); 
      } 

      var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); 
      using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) 
      { 
       var result = streamReader.ReadToEnd(); 
      } 

回答

0

由於您使用C#,您可以使用現有的.NET SDK here建立你的請求對象,並收集響應。這裏有代碼示例,幾乎可以使用新的Paypal API執行所有操作。