gpt4 book ai didi

c# - PayPal 支付操作 - 错误 81002

转载 作者:行者123 更新时间:2023-11-30 20:45:11 24 4
gpt4 key购买 nike

我不确定为什么这个 PayPal Pay 操作会给我这个错误,即使我似乎已经涵盖了所有必填字段:

Error Code: 81002 Severity: Error Message: Unspecified Method (Method Specified is not Supported)"

string postData = JsonConvert.SerializeObject(request);

postData 的值:

"actionType=PAY
&currencyCode=USD
&cancelUrl=https%3a%2f%2fexample.com%2fcancel
&returnUrl=https%3a%2f%2fexample.com%2freturn
&requestenvelope.errorLanguage=en_US
&receiverList.receiver(0).email=recipientemail%40gmail.com
&receiverList.receiver(0).amount=0.05
&VERSION=94.0
&USER=bizemail-facilitator_api1.gmail.com
&PWD=xxxxx
&SIGNATURE=xxxxxxxxx"

这是我发帖的方式:

 SendRequest("https://api-3t.sandbox.paypal.com/nvp", postData);

public string SendRequest(string url, string postData)
{
var uri = new Uri(url);
var request = WebRequest.Create(uri);
var encoding = new UTF8Encoding();
var requestData = encoding.GetBytes(postData);

request.ContentType = "application/x-www-form-urlencoded";
request.Method = "POST";
request.Timeout = (300*1000); //TODO: Move timeout to config
request.ContentLength = requestData.Length;

using (var stream = request.GetRequestStream()) {
stream.Write(requestData, 0, requestData.Length);
}

var response = request.GetResponse();

string result;

using (var reader = new StreamReader(response.GetResponseStream(), Encoding.ASCII)) {
result = reader.ReadToEnd();
}

return result;
}

最佳答案

PAY 方法在 NVP api 上不存在。找到该 API 支持的方法的完整列表 here .

不过,PAY 方法是在 Adaptive Payments API 中定义的。根据您的需要,您有两种选择:

  • 将端点更改为 https://svcs.paypal.com/AdaptivePayments/PAY 并修改您的值
  • 使用另一种方法,例如 DoDirectPayment,但我不确定它是否能满足您的要求。

关于c# - PayPal 支付操作 - 错误 81002,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28511933/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com