我想在asp.net中实现paypal快速结账。现在我收到错误“安全标头无效”。
// build request
SetExpressCheckoutRequestDetailsType reqDetails = new SetExpressCheckoutRequestDetailsType();
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
// TODO: Be sure to update hosting address in Web.Config!!
reqDetails.ReturnURL = "http://localhost:14797/WebSite2/success.aspx";
reqDetails.CancelURL = "http://localhost:14797/WebSite2/cancel.aspx";
reqDetails.NoShipping = "1";
reqDetails.OrderTotal = new BasicAmountType()
{
currencyID = CurrencyCodeType.USD,
Value = "10.00"
};
SetExpressCheckoutReq req = new SetExpressCheckoutReq()
{
SetExpressCheckoutRequest = new SetExpressCheckoutRequestType()
{
Version = PayPalAPIUtil.Version,
SetExpressCheckoutRequestDetails = reqDetails
}
};
// query PayPal and get token
SetExpressCheckoutResponseType resp = PayPalAPIUtil.BuildPayPalWebservice().SetExpressCheckout(req);
PayPalAPIUtil.HandleError(resp);
// redirect user to PayPal
Response.Redirect(string.Format("{0}?cmd=_express-checkout&token={1}",
"https://www.sandbox.paypal.com/cgi-bin/webscr", resp.Token));