我在网上找到了这段代码。
但是根据 WSDL,函数paypalAAInt
在 PayPal API 中不存在。谁能帮助我如何在 Asp.Net 中集成PayPal快速结帐
CustomSecurityHeaderType type = new CustomSecurityHeaderType();
type.Credentials = new UserIdPasswordType()
{
Username = "thakur_1322207622_biz_api1.gmail.com",
Password = "1322207646",
Signature = "An5ns1Kso7MWUdW4ErQKJJJ4qi4-Asr3E2CXn-a5b6uZmCDTPNNvpGBl"
};
SetExpressCheckoutRequestDetailsType sdt = new SetExpressCheckoutRequestDetailsType();
sdt.NoShipping = "1";
PaymentDetailsType pdt = new PaymentDetailsType()
{
OrderDescription = "Order for 1 year" + Request.Cookies["username"].Value,
OrderTotal = new BasicAmountType()
{
currencyID = CurrencyCodeType.USD,
Value = "95.40"
}
};
sdt.PaymentDetails = new PaymentDetailsType[] { pdt };
sdt.CancelURL = "http://localhost:2326/MusicStore/Default.aspx";
sdt.ReturnURL = "http://localhost:2326/MusicStore/regsuccessfull.aspx";
SetExpressCheckoutReq req = new SetExpressCheckoutReq()
{
SetExpressCheckoutRequest = new SetExpressCheckoutRequestType()
{
SetExpressCheckoutRequestDetails = sdt,
Version = "60.0"
}
};
var resp = paypalAAInt.SetExpressCheckout(ref type, req);
if (resp.Errors != null && resp.Errors.Length > 0)
{
// errors occured
throw new Exception("Exception(s) occured when calling PayPal. First exception: " +
resp.Errors[0].LongMessage);
}
Response.Redirect(string.Format("{0}?cmd=_express-checkout&token={1}",
ConfigurationManager.AppSettings["PayPalSubmitUrl"], resp.Token));
这是我正在使用的代码,但PayPal API 中不存在函数paypalAAInt
。应该使用哪个函数而不是paypalAAInt
?
如果您有一个 PayPalAPIAAInterfaceClient
对象,则方法SetExpressCheckout
可用,如果您添加了对 WSDL 的 Web 引用,该方法应该可用。
这是您缺少的行:
PayPalAPIAAInterfaceClient paypalAAInt = new PayPalAPIAAInterfaceClient();