Braja Lal Mahanty

Braja Lal Mahanty

  • 2k
  • 28
  • 1.9k

How to make a payment gateway from square.com in my c# mvc p

Oct 22 2016 10:08 AM
I want to add payment gateway from square.com in my c# mvc project. I already tried lots of things from google but unable to find proper solution.
Here is my controller code I already tried
public ActionResult Squre()
{
_transactionApi = new TransactionApi();
var client = new RestSharp.RestClient();
var request = new RestSharp.RestRequest("https://connect.squareup.com/v1/me/payments", RestSharp.Method.GET);
request.RequestFormat = RestSharp.DataFormat.Json;
request.AddHeader("Authorization", "Bearer sq0atp-zHuWWPD4ds9J6YoVlEoYZg");
setHeaders(request);
var Response = client.Execute(request);
HttpWebResponse response = null;
string responseMessage = null;
response = (HttpWebResponse)request.GetResponse();
if (response.StatusCode == HttpStatusCode.OK)
{
using (Stream stream = response.GetResponseStream())
{
using (StreamReader reader = new StreamReader(stream))
{
responseMessage = reader.ReadToEnd();
}
}
}
return View();
}
namespaces i have used mentioned below here
using System.Runtime.Serialization.Json;
using Square.Connect.Api;
using Square.Connect.Model
I want to make a payment gateway from square in my site. i need full tutorial for this can anyone help me please. What should i do??
Which things i have to modified in my code. Can anyone modify my code please or please give me the proper code

Answers (2)