我正在使用以下 Web 服务来实现快速结帐
//Demo
https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl
//Live
https://www.paypal.com/wsdl/PayPalSvc.wsdl
我从 belo 博客 URL 获得了帮助。
错误是 - 在响应对象中,当我在 xp-64 位(端口和 iis6 两者)、window server 2008(iis7 32 位模式)上运行相同的代码时,我得到“resp.Token is null”
但是在win-7 32位iis7和端口上运行良好(没有错误,令牌是坚果空值)
我的代码如下。
protected void btnPaypal_Click(object sender, EventArgs e)
{
CustomSecurityHeaderType type = new CustomSecurityHeaderType();
type.Credentials = new UserIdPasswordType()
{
Username = "removed",
Password = "removed",
Signature = "removed"
};
SetExpressCheckoutRequestDetailsType sdt = new SetExpressCheckoutRequestDetailsType();
sdt.NoShipping = "1";
PaymentDetailsType pdt = new PaymentDetailsType()
{
OrderDescription = "Payment Details Sushant",
OrderTotal = new BasicAmountType()
{
currencyID = CurrencyCodeType.USD,
Value = "100.00"
}
};
sdt.PaymentDetails = new PaymentDetailsType[] { pdt };
sdt.CancelURL = "http://localhost/OAT/Default.aspx";
sdt.ReturnURL = "http://localhost/OAT/ExpressCheckoutSuccess.aspx";
SetExpressCheckoutReq req = new SetExpressCheckoutReq()
{
SetExpressCheckoutRequest = new SetExpressCheckoutRequestType()
{
SetExpressCheckoutRequestDetails = sdt,
Version = "60.0"
}
};
PayPalAPIAAInterfaceClient paypalAAInt = new PayPalAPIAAInterfaceClient();
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 + resp.Errors.Length.ToString());
}
// error is here.. that resp.Token is null on xp-64 bit port and iis6 both, but running fine on win-7 32 bit iis7 and port, and w
Response.Redirect(string.Format("{0}?cmd=_express-checkout&token={1}",
"https://www.paypal.com/cgi-bin/webscr", resp.Token));
}