C# 基础连接已关闭:发送时发生意外错误
我试图在我的网站上使用直接付款方式 这就是我所指的样本:C# 基础连接已关闭:发送时发生意外错误,c#,paypal,C#,Paypal,我试图在我的网站上使用直接付款方式 这就是我所指的样本: using com.paypal.sdk.services; using com.paypal.sdk.profiles; using com.paypal.sdk.util; using com.paypal.soap.api; namespace ASPDotNetSamples { public class DoDirectPayment { public DoDirectPayment()
using com.paypal.sdk.services;
using com.paypal.sdk.profiles;
using com.paypal.sdk.util;
using com.paypal.soap.api;
namespace ASPDotNetSamples
{
public class DoDirectPayment
{
public DoDirectPayment()
{
}
public string DoDirectPaymentCode(string paymentAction, string amount, string creditCardType, string creditCardNumber, string expdate_month, string cvv2Number, string firstName, string lastName, string address1, string city, string state, string zip, string countryCode, string currencyCode)
{
com.paypal.soap.api.DoDirectPaymentReq req = new com.paypal.soap.api.DoDirectPaymentReq();
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
// Set up your API credentials, PayPal end point, API operation and version.
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "xxxxxxxxxxxxx";
profile.APISignature = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
profile.Environment = "sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
encoder["METHOD"] = "DoDirectPayment";
// Add request-specific fields to the request.
encoder["PAYMENTACTION"] = paymentAction;
encoder["AMT"] = amount;
encoder["CREDITCARDTYPE"] = creditCardType;
encoder["ACCT"] = creditCardNumber;
encoder["EXPDATE"] = expdate_month;
encoder["CVV2"] = cvv2Number;
encoder["FIRSTNAME"] = firstName;
encoder["LASTNAME"] = lastName;
encoder["STREET"] = address1;
encoder["CITY"] = city;
encoder["STATE"] = state;
encoder["ZIP"] = zip;
encoder["COUNTRYCODE"] = countryCode;
encoder["CURRENCYCODE"] = currencyCode;
// Execute the API operation and obtain the response.
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"];
}
}
}
这是链接:
当我传递适当的参数并尝试运行代码时,我收到以下错误:“基础连接已关闭:发送时发生意外错误。”第行:
SOAP服务调用位于dll内部。有人能告诉我发生了什么以及如何解决吗?这是因为该示例似乎过时了,请在此处阅读更多内容:
- 这是因为该样本似乎过时了,请在此处阅读更多内容:
pp_response = (DoDirectPaymentResponseType)caller.Call("DoDirectPayment", pp_Request);