0

I want to implement paypal express checkout in asp.net . now i am getting error"Security header is not valid".

 // 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));
Raging Bull
  • 18,593
  • 13
  • 50
  • 55
kinshuk
  • 21
  • 6
  • There's a similar question here, maybe it could help: http://stackoverflow.com/questions/1712685/express-checkout-error-message-security-header-is-not-valid – mamoo Feb 21 '14 at 10:22
  • i have already checked but i am getting solution of this problem. – kinshuk Feb 21 '14 at 10:27
  • have you tried using a different SecurityProtocol? TLS maybe? – KevDevMan Feb 21 '14 at 12:08
  • yes i have tried with TLS , getting same error. can you provice me c# code for paypal express checkout ? – kinshuk Feb 21 '14 at 13:57

0 Answers0