我正在尝试为托管支付网关发送回调通知,但我收到了“422 Unprocessable Entity”响应。当我尝试使用Postman并设置相同的值(得到422响应)时,它正在运行得很好,我得到了“200 OK”响应,我的产品的付款状态也在变化要“付钱”。这是我从邮差中复制的生成代码段。
string strBuilder = "x_account_id=" + account_id;
strBuilder += "&x_reference=" + reference;
strBuilder += "&x_currency=" + currency;
strBuilder += "&x_test=" + test;
strBuilder += "&x_amount=" + amount;
strBuilder += "&x_gateway_reference=" + gateway_reference;
strBuilder += "&x_timestamp=" + timestamp;
strBuilder += "&x_result=" + resultcode;
strBuilder += "&x_signature=" + signature;
Response.Write("strBuilder : " + strBuilder);
var client = new RestClient(url_callback);
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddHeader("cache-control", "no-cache");
request.AddParameter("application/x-www-form-urlencoded", strBuilder, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Response.Write("Response : " + response.ResponseStatus + " " + response.StatusCode);
任何人都可以帮我吗?谢谢。