I implemented the following code and it worked properly in Sandbox but now it is not working and getting not acceptable error. I checked on the production account which works perfectly. So please let me know the exact reason why getting this error for the sandbox account.
Here is the implemented code :
string CloverUrl = string.Empty, baseUrl = string.Empty;
if (System.Configuration.ConfigurationManager.AppSettings["CloverUrl"] != null)
CloverUrl = System.Configuration.ConfigurationManager.AppSettings["CloverUrl"];
baseUrl = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath;
CloverRoot cloverParemeters = new CloverRoot();
cloverParemeters.customer = new Customer
{
firstName = "Girish",
lastName = "Kolte"
};
cloverParemeters.redirectUrls = new RedirectUrls
{
success = baseUrl + "CloverSucess.aspx?code=" + Common.Encrypt(id.ToString()) + "&id=" + Common.Encrypt(GuidId.ToString()),
failure = baseUrl + "CloverFailed.aspx?code=" + Common.Encrypt(id.ToString())
};
cloverParemeters.shoppingCart = new ShoppingCart
{
lineItems = new List<LineItem>
{
new LineItem {
price = Math.Round(Convert.ToDouble(amt * 100),2),
name= "Total Payment",
unitQty = Convert.ToDouble(1)
}
},
total = Math.Round((objInvoice.SubTotal + objInvoice.SaleTaxAmount),2),
subtotal = Math.Round(objInvoice.SubTotal,2),
totalTaxAmount = Math.Round(objInvoice.SaleTaxAmount,2)
};
var json = new System.Web.Script.Serialization.JavaScriptSerializer();
string jsonData = json.Serialize(cloverParemeters);
var client = new RestClient(CloverUrl + "/invoicingcheckoutservice/v1/checkouts");
var request = new RestRequest(Method.POST);
request.AddHeader("accept", "application/json");
request.AddHeader("X-Clover-Merchant-Id", mId);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Bearer " + APIToken);
request.AddParameter("application/json", jsonData, RestSharp.ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
CloverData data = JsonConvert.DeserializeObject<CloverData>(response.Content.ToString());
if (response.StatusCode == HttpStatusCode.OK)
{
}
this above code getting the error now for the sandbox. please provide a feasible solution as soon as possible it is a little bit urgent.
Thanks