Hello, I was using an older PayPalSoapProtocol.cs file that had the API structure. Its working ok but has an old version of the API.
In a parallel project in VS I'm now using the webreference with
https://svcs.paypal.com/AdaptivePayments?wsdl
My (previously working) code:
Code:request.Headers.Add("CLIENT_AUTH", "No cert");
request.Headers.Add("X-PAYPAL-SECURITY-USERID", WebConfigurationManager.AppSettings["APIUser"]);
request.Headers.Add("X-PAYPAL-SECURITY-SIGNATURE", WebConfigurationManager.AppSettings["APISignature"]);
request.Headers.Add("X-PAYPAL-SECURITY-PASSWORD", WebConfigurationManager.AppSettings["APIPassword"]);
request.Headers.Add("X-PAYPAL-APPLICATION-ID", WebConfigurationManager.AppSettings["applicationId"]);
request.Headers.Add("X-PAYPAL-MESSAGE-PROTOCOL", "SOAP11");
Code:
AdaptivePayments adps = new AdaptivePayments();
adps.Url = WebConfigurationManager.AppSettings["APIPreapproval"];
adps.Url += "?USER=" + WebConfigurationManager.AppSettings["APIUser"];
adps.Url += "&PWD=" + WebConfigurationManager.AppSettings["APIPassword"];
adps.Url += "&SIGNATURE=" + WebConfigurationManager.AppSettings["APISignature"];
and this are the objects we need to create
Code:
RequestEnvelope envelope = new RequestEnvelope();
envelope.detailLevel = DetailLevelCode.ReturnAll;
envelope.detailLevelSpecified = true;
envelope.errorLanguage = "en_US";
PreapprovalRequest MyPreapprovalRequest = new PreapprovalRequest();
PreapprovalResponse MyPreapprovalResponse = new PreapprovalResponse();
ClientDetailsType ClientDetails = new ClientDetailsType();
ClientDetails.applicationId = WebConfigurationManager.AppSettings["applicationId"];
ClientDetails.ipAddress = WebConfigurationManager.AppSettings["ipAddress"];
ClientDetails.partnerName = WebConfigurationManager.AppSettings["partnerName"];
ClientDetails.deviceId = WebConfigurationManager.AppSettings["deviceId"];
MyPreapprovalRequest.clientDetails = ClientDetails;
MyPreapprovalRequest.requestEnvelope = envelope;
MyPreapprovalResponse = adps.Preapproval(MyPreapprovalRequest);
But I get error with wrong parameters.
Am I missing parameters on the new version or have too much?
Thanks!