Hi I am trying to test hosted checkout using
https://docs.clover.com/reference/createcheckout
but everytime i am gettting this error
{
"status": {
"reason": "Bad Request",
"code": 400
},
"message": "COS create customer failed with exception: 400 Bad Request: [{\"message\":\"Please provide a valid email\"}]"
}
here is the request i am sending
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://sandbox.dev.clover.com/invoicingcheckoutservice/v1/checkouts"),
Headers =
{
{ "accept", "application/json" },
{ "X-Clover-Merchant-Id", "4JFGGNQ1YN471" },
{ "authorization", "Bearer [Private token from Ecommerce API Tokens]" },
},
Content = new StringContent("{\"customer\":{\"emailAddresses\":{\"elements\":[{\"id\":\"600\",\"emailAddress\":\"william.smith@dcode.com\"}]},\"phoneNumbers\":{\"elements\":[{\"id\":\"600\",\"phoneNumber\":\"123442123\"}]},\"firstName\":\"William\",\"lastName\":\"Smith\",\"phoneNumber\":\"7077777777\",\"email\":\"\",\"id\":\"600\"},\"shoppingCart\":{\"lineItems\":[{\"name\":\"Coke\",\"price\":185,\"unitQty\":1}],\"total\":175},\"merchantUuid\":\"712W8BCT38EM1\"}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}