I try to perform some payments using DoPapture using the Paypal API, and I get a Fatal Exception in the line of code where I set the CertificateFile property to the location of my certificate file.
The corresponding code is given below:
using com.paypal.sdk.profiles; using com.paypal.sdk.services; using com.paypal.sdk.util; IAPIProfile profile = ProfileFactory.createSignatureAPIProfile(); profile.CertificateFile = @"~\MyTestCertificate.txt";
Collapsing the details of the Exception does not give me more information; it more or less simply confirms that Fatal Exception was actually thrown.
Leaving the tilde and backslash, he is also mistaken:
profile.CertificateFile = @"MyTestCertificate.txt";
I thought that maybe I need the contents of the file instead of the place, so I tried the following, but got the same error:
profile.CertificateFile = new StreamReader(@"MyTestCertificate.txt").ReadToEnd().ToString();
It seems that no matter what you set for the CertificateFile property, you get a fatal exception.
A few questions:
- Where can I find documentation for the IAPIProfile class in the Paypal API, in particular, documentation for the
CertificateFile property - If I should not indicate the path to my certificate file in this place, what should I do?
To confirm, MyTestCertificate.txt added to my solution, and Copy to Output Directory is Copy Always .
The exception text is as follows:
{"An exception of type" com.paypal.sdk.exceptions.FatalException "has been thrown." }
StackTrace is as follows:
at com.paypal.sdk.profiles.SignatureAPIProfile.set_CertificateFile(String value) at MyProject_Payment_Processing.Paypal.DoCaptureCode(String authorization_id, String amount) in C:\Users\JMK\documents\visual studio 2010\Projects\MyProject Payment Processing\MyProject Payment Processing\Paypal.cs:line 16 at MyProject_Payment_Processing.Program.Main(String[] args) in C:\Users\JMK\documents\visual studio 2010\Projects\MyProject Payment Processing\MyProject Payment Processing\Program.cs:line 15 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
The Paypal API uses Log4Net, which logs the error as follows:
Jul 20, 2012 12:39:11 PM FATAL [FatalException] com.paypal.sdk.exceptions.FatalException: an exception of type "com.paypal.sdk.exceptions.FatalException" was thrown.
thanks