You checked the addresses of the endpoints in the web.config file
They should be referenced at the following URL.
For API certificate => SOAP https://api.sandbox.paypal.com/2.0/
For API Signature => SOAP https://api-3t.sandbox.paypal.com/2.0/
If you use a signature, use the following code
CustomSecurityHeaderType type = new CustomSecurityHeaderType(); type.Credentials = new UserIdPasswordType() { Username = ConfigurationManager.AppSettings["PayPalUserName"], //Not paypal login username Password = ConfigurationManager.AppSettings["PayPalPassword"], //not login password Signature = ConfigurationManager.AppSettings["PayPalSignature"] };
To get a Paypal signature, follow the link
For more information, click here.
Update:
Please check the following code that it works for me
CustomSecurityHeaderType type = new CustomSecurityHeaderType(); type.Credentials = new UserIdPasswordType() { Username = ConfigurationManager.AppSettings["PayPalUserName"], Password = ConfigurationManager.AppSettings["PayPalPassword"], Signature = ConfigurationManager.AppSettings["PayPalSignature"] }; PaymentDetailsItemType[] pdItem = new PaymentDetailsItemType[1]; pdItem[0] = new PaymentDetailsItemType() { Amount = new BasicAmountType(){currencyID = CurrencyCodeType.USD,Value = ItemPrice}, Name = ItemName, Number = ItemNumber, Description = ItemDescription, ItemURL = ItemUrl }; SetExpressCheckoutRequestDetailsType sdt = new SetExpressCheckoutRequestDetailsType(); sdt.NoShipping = "1"; PaymentDetailsType pdt = new PaymentDetailsType() { OrderDescription = OrderDesc, PaymentDetailsItem = pdItem, OrderTotal = new BasicAmountType() { currencyID = CurrencyCodeType.USD, Value = ItemPrice } }; sdt.PaymentDetails = new PaymentDetailsType[] { pdt }; sdt.CancelURL = "http://localhost:62744/PaymentGateway/PaymentFailure.aspx"; sdt.ReturnURL = "http://localhost:62744/PaymentGateway/ExpressCheckoutSuccess.aspx"; SetExpressCheckoutReq req = new SetExpressCheckoutReq() { SetExpressCheckoutRequest = new SetExpressCheckoutRequestType() { SetExpressCheckoutRequestDetails = sdt, Version = "92.0" } }; var 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); } Response.Redirect(string.Format("{0}?cmd=_express-checkout&token={1}", ConfigurationManager.AppSettings["PayPalOriginalUrl"], resp.Token));
Raghuveer
source share