我正在使用 Paypal_base.dll 在我的 asp.net 网站中处理 Paypal 交易,但出现错误。我的代码如下所示:
string Response;
const string paymentAction = "Sale";
const string currency = "USD";
var caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
profile.APIUsername = ConfigurationManager.AppSettings["APIUsername"];
profile.APIPassword = ConfigurationManager.AppSettings["APIPassword"];
profile.APISignature = ConfigurationManager.AppSettings["token"];
profile.Environment= "SandBox";
caller.APIProfile = profile;
var encoder = new NVPCodec();
encoder["VERSION"] = "58.0";
encoder["METHOD"] = "DoDirectPayment";
encoder["PAYMENTACTION"] = paymentAction;
encoder["AMT"] = amount;
encoder["CREDITCARDTYPE"] = creditCardType;
encoder["ACCT"] = creditCardNumber;
encoder["EXPDATE"] = expdateMonth;
// encoder["CVV2"] = cvv2Number;
// encoder["FIRSTNAME"] = firstName;
// encoder["LASTNAME"] = lastName;
// encoder["STREET"] = city + ", " + state + ", " + countryCode;
// encoder["CITY"] = city;
// encoder["STATE"] = state;
// encoder["ZIP"] = zip;
encoder["COUNTRYCODE"] = countryCode;
encoder["CURRENCYCODE"] = currency;
// Execute the API operation and obtain the response.
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = caller.Call(pStrrequestforNvp);
var decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
Response = decoder["L_LONGMESSAGE0"];
if (decoder["ACK"] == "Success")
{
}
return decoder["ACK"];
Response = decoder["L_LONGMESSAGE0"]; 处的值 是“超时处理请求”
并且解码器[“ACK”]给出“失败”消息。
caller.Call(pStrrequestforNvp) 有这个值:
TIMESTAMP=2013%2d10%2d02T22%3a40%3a04Z&CORRELATIONID=fa19cc06164da&ACK=失败&L_ERRORCODE0=10001&L_SHORTMESSAGE0=内部%20错误&L_LONGMESSAGE0=超时%20处理%20请求