eBay Marketplace account deletion endpoint validation failed

894 Views Asked by At

Marketplace account deletion endpoint validation failed. Click here to learn more about setting up an endpoint.

I have created an API method to respond challenge response to eBay. But validation is failing I am not sure what wrong I am doing here.

Below is the code logic I added.

 public ActionResult<string> ChallengeResponse([FromQuery] string challenge_code)
    {
        try
        {
            string verificationToken = _configuration["eBayVerificationToken"];
            string endpoint = _configuration["eBayNotificationEndPoint"];
            string challengeResponse = string.Empty;
            IncrementalHash sha256 = IncrementalHash.CreateHash(HashAlgorithmName.SHA256);
            sha256.AppendData(Encoding.UTF8.GetBytes(challenge_code));
            sha256.AppendData(Encoding.UTF8.GetBytes(verificationToken));
            sha256.AppendData(Encoding.UTF8.GetBytes(endpoint));
            byte[] bytes = sha256.GetHashAndReset();
            challengeResponse = BitConverter.ToString(bytes).Replace("-", string.Empty).ToLower();
            JObject json = JObject.Parse("{\"challengeResponse\":\"" + challengeResponse + "\"}");
            return JsonConvert.SerializeObject(json);
        }
        catch (Exception ex)
        {
            return string.Empty;
        }
    }

enter image description here

1

There are 1 best solutions below

0
On

I used a object with challenge response to the one member:

class challengeResponseObj
{
    public string challengeResponse { get; set; }
} 

Then I just assign the value of the response and return the object as a JSON result:

challengeResponseObj resObj = new challengeResponseObj()
{
    challengeResponse = resMessage
};
return new JsonResult(resObj);