我正在使用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”]; 是“超时处理请求”
和decoder [“ACK”]给出“失败”消息。
caller.Call(pStrrequestforNvp)具有以下值:
TIMESTAMP = 2013%2D10%2d02T22%3a40%3a04Z&安培;的correlationID = fa19cc06164da&安培; ACK =失败&安培; L_ERRORCODE0 = 10001&安培; L_SHORTMESSAGE0 =内部%20Error&安培; L_LONGMESSAGE0 =超时%20processing%20request