Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8303515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:33:55+00:00 2026-06-08T17:33:55+00:00

I am trying to DoCapture some payments using the Paypal API and I am

  • 0

I am trying to DoCapture some payments using the Paypal API and I am getting a Fatal Exception on the line of code where I set the CertificateFile property to the location of my certificate file.

The relevant code is below:

using com.paypal.sdk.profiles;
using com.paypal.sdk.services;
using com.paypal.sdk.util;

IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
profile.CertificateFile = @"~\MyTestCertificate.txt";

Drilling down into the Exceptions details doesn’t give me much more information, it more or less just confirms that a Fatal Exception has indeed been thrown.

Leaving out the tilde and backslash like so throws the same error:

profile.CertificateFile = @"MyTestCertificate.txt";

I thought that maybe I needed the contents of the file, instead of the location so I tried the following but got the same error:

profile.CertificateFile = new StreamReader(@"MyTestCertificate.txt").ReadToEnd().ToString();

It seems that whatever you set the CertificateFile property to, you get a fatal exception.

A couple of questions:

  1. Where can I find documentation on the IAPIProfile class in the Paypal API, in particular documentation for the CertificateFile property
  2. If I am not supposed to put the path to my certificate file in this location, what am I supposed to do?

Just to confirm, MyTestCertificate.txt is added to my solution and Copy to Output Directory is set to Copy Always.

The exception text is as follows:

{“Exception of type ‘com.paypal.sdk.exceptions.FatalException’ was thrown.”}

The StackTrace looks like this:

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 so:

20 Jul 2012 12:39:11 FATAL [FatalException]
com.paypal.sdk.exceptions.FatalException: Exception of type ‘com.paypal.sdk.exceptions.FatalException’ was thrown.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:33:57+00:00Added an answer on June 8, 2026 at 5:33 pm

    It turns out aydiv was right, I had to use WinHttpCertCfg to register the certificate. Martin was also right in that I was using the signature profile, as opposed to the certificate profile.

    The first thing I had to do was use OpenSSL to encrypt my certificate, using the following command. I had to enter a password here, which I used later. This created an encrypted certificate file named paypal_cert.p12:

    openssl pkcs12 -export -in MyTestCertificate.txt -inkey MyTestCertificate.txt -out paypal_cert.p12

    I then installed WinHttpCertCfg and used the following command to register my certificate, substituting PFXPassword for the password I entered earlier:

    winhttpcertcfg -i PFXFile -c LOCAL_MACHINE\My -a JMK -p PFXPassword

    Also, I was using the NVP DLL files before, I instead need to use the SOAP dll’s from here. This meant that I had to replace NVPCallerServices in my code with Callerservices, along with a few other things.

    My final code for performing a Paypal DoCapture in C# .Net is below, hopefully this will help somebody who comes across this problem in the future!

    class Paypal
    {
        public string DoCaptureCode(string authorization_id, string amount)
        {
            CallerServices caller = new CallerServices();
    
            IAPIProfile profile = ProfileFactory.createSSLAPIProfile();
    
            profile.APIUsername = "JMK";
            profile.APIPassword = "FooBar";
            profile.CertificateFile = @"~\MyTestCertificate.txt";
            profile.Environment = "sandbox";
            caller.APIProfile = profile;
    
            DoCaptureRequestType pp_request = new DoCaptureRequestType();
            pp_request.Version = "51.0";
    
            pp_request.AuthorizationID = authorization_id;
            pp_request.Amount = new BasicAmountType();
            pp_request.Amount.Value = amount;
            pp_request.Amount.currencyID = CurrencyCodeType.GBP;
            pp_request.CompleteType = CompleteCodeType.Complete;
    
            DoCaptureResponseType pp_response = new DoCaptureResponseType();
            pp_response = (DoCaptureResponseType)caller.Call("DoCapture", pp_request);
            return pp_response.Ack.ToString();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to give a textarea some default text using the formtastic rails helper. I
Trying to build out an exception if move.UserId does not equal currentUserId then Redirect
Trying to write a windows speech recognition macro. Written using XML and scripting language
Trying to find some information on this but am unable to get any results
Trying to execute a Powershell cmdlet from a MVC 3 Controller using impersonation but
Trying to understand how EDE works by using it to generate Makefiles for a
Trying to make a screenshot with SlimDX: using System; using System.ComponentModel; using System.Data; using
Trying to do a simple insert, and this one line is giving me issues.
Trying to build a Metro app using Javascript and having issues with IndexedDb. I
Trying to create an SSIS package to process a Datacube. Using SMS 2008, I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.