Programming Code

First Data’s directions for setting up their web service in Visual Studio is very confusing and I ended up calling them for help. Visual Studio 2010 has different directions than previous versions of Visual Studio. Here is how I got it to work.

First install the certificate, go into Internet Options in the Control Panel. Choose the Content tab then Certificates. On the Personal tab, click Import… and follow the wizard here to add your certificate. I did this mostly by accident only because I have had to do this before for other stuff I have done in the past. You might not need to do those other instructions in their documentation. I am using Windows XP, so your mileage may vary. (Bonus points if you leave a comment with Vista/7 instructions.)

After that you can setup the web service:

  1. Download all of the files they list in the documentation. I put them all into C:\FDGGWSClient. Put a1.xsd, fdggwsapi.xsd, and v1.xsd into C:\FDGGWSClient\schemas_us. Put order.wsdl into C:\FDGGWSClient\wsdl. I also put the certificate (WSxxxxxxxx._.1.pem) in the root folder (C:\FDGGWSClient).
  2. In Visual Studio 2010, right click on References and choose Add Service Reference. Click on Advanced… then on the bottom of the new window click Add Web Reference…
  3. The URL you enter here is the file path to order.wsdl. In my case it’s C:\FDGGWSClient\wsdl\order.wsdl.

This should allow it to work.

The other thing I did was create a separate class for all of the processing. So my constructor had:

    private FDGGWSApiOrderService oFDGGWSApiOrderService = null;

    /// 
    /// Initializes a new instance of the test version of the  class.
    /// 
    /// if set to true [test].
    public ProcessCreditCard()
    {
        ServicePointManager.Expect100Continue = false;
        // Initialize Service Object 
        oFDGGWSApiOrderService = new FDGGWSApiOrderService();
        // Set the WSDL URL
        oFDGGWSApiOrderService.Url = @Settings.Default.CcApiUrl;
        // Configure Client Certificate  
        oFDGGWSApiOrderService.ClientCertificates.Add(X509Certificate.CreateFromCertFile(Settings.Default.CertFile));
        // Set the Authentication Credentials
        NetworkCredential nc = new NetworkCredential(Settings.Default.CertUser, Settings.Default.CertPass);
        oFDGGWSApiOrderService.Credentials = nc;
    }

Then I created a method to create the rest of the information needed to send the transaction to them.

First Data has been notorious on how to set up and start using their services. I hope this helps you get started.

Like this? Give my answer some love on StackOverflow.

Categories:

Tags:

No responses yet

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.