Connecting to the LinkPoint staging server for payments integration

Posted August 4th, 2009 by Nazmul

We believe in the power of ONE, at ScreamingToaster. We believe in innovation - ONE experience can change a person's life. We believe in partnerships - ONE endeavor can establish lasting trust & mutual success. We believe in education - ONE training course can empower a developer for life. We believe in giving back - ONE open-source project can inspire future entrepreneur. ONE person can become the leader that starts a revolution. ONE company can change the world and make it a better place - join us.

Introduction

I’ve build payments and licensing infrastructure for my ScreamingToaster ONE Platform, that allows mobile, web, and desktop software to share the same payments and licensing services. For payments, I integrated with FirstData Global Gateway, using the LinkPoint API. The LinkPoint API is good and FirstData provides lots of documentation that shows you how to get started. However, there is one huge flaw in their API and support docs – they don’t show you how to connect to the LinkPoint TEST gateway. All the code and examples are geared to connect to the PRODUCTION/LIVE gateway. If you’re like me, you want to test your stuff before hooking up to the LIVE gateway :) . So this tutorial is dedicated to simply connecting to their TEST gateway, so that you can test your code before going live.

Even if you have a production account, in order to connect to the test gateway, you will need a test account. Sign up for one here from FirstData. LinkPoint is used by lots of payment gateway services, not just FirstData, so this information should be relevant to anyone using LinkPoint APIs.

Using LinkPoint staging server

The LinkPoint staging server uses a self signed certificate. This makes it tough to connect to the server from Java. You have to import the certificate of the staging server into your Java VM. You must have a openssl for this to work. Here’s how:

Step1: openssl s_client -connect staging.linkpt.net:1129

This will get the certificate from the server. Copy the bits between begin and end certificate. Here’s a screenshot:

image

Here’s what it looks like:

-----BEGIN CERTIFICATE-----
MIIC3zCCAkgCAQ4wDQYJKoZIhvcNAQEEBQAwgbYxCzAJBgNVBAYTAlVTMRMwEQYD
VQQIEwpDYWxpZm9ybmlhMQ8wDQYDVQQHEwZNYWxpYnUxIDAeBgNVBAoTF0xpbmtQ
b2ludCBJbnRlcm5hdGlvbmFsMSAwHgYDVQQLExdJbnRlcm5ldCBTb2x1dGlvbnMg
VGVhbTEaMBgGA1UEAxMRd3d3Lmxpbmtwb2ludC5jb20xITAfBgkqhkiG9w0BCQEW
EmluZm9AbGlua3BvaW50LmNvbTAeFw0wMzA2MTIyMDQzMDRaFw0xMzA2MDkyMDQz
MDRaMIG4MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTERMA8GA1UE
BxMITW9vcnBhcmsxIDAeBgNVBAoTF0xpbmtQb2ludCBJbnRlcm5hdGlvbmFsMSAw
HgYDVQQLExdJbnRlcm5ldCBTb2x1dGlvbnMgVGVhbTEaMBgGA1UEAxMRZGV2Lmxp
bmtwb2ludC5jb20xITAfBgkqhkiG9w0BCQEWEmluZm9AbGlua3BvaW50LmNvbTCB
nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAx/N2JI3GyaJFYmq8Xa5DwU3gYOep
WafKpnlnCAmZ1+rlQ8XXUutrUVDqaLS+Jwqs/FR30kHe5WUjEe1AwXNT7aNaC8Ho
G2Kt23DvbV7nw8lDZYYl7Wg42/2T7U16PCJSgBEehQT6P8IczyVpzsXOjVLY+b62
LBZlIQgDLfDvgRMCAwEAATANBgkqhkiG9w0BAQQFAAOBgQAl4ojyNFYbpY2dNsbU
6FMXHQkLaFjgiaoOVLtz+jXLYHp2Q47UjHEKcCCU1eyCc3At54XtVdDKelXmbM89
iFJTXyATd6A63oEbAgr5PRjAJQYUqC/CVjjFyOdd/asD07PKBKRFmS6Qy1jZVuCd
ITkiwYJXAQpOklR75b8ERGxcng==
-----END CERTIFICATE-----

Save this certificate as “staging_cert.pem”.

Step2: keytool -import -file staging_cert.pem -alias linkptstaging

This will import the staging certificate file into a keystore file, using the JDK’s keytool program. The keystore file is stored in $home/.keystore by default. So you can either move it to a folder of your choice or leave it there. In this example I’m moving the keystore file to “/myfolder”.

Step3: java -Djavax.net.ssl.trustStore=/myfolder/.keystore …

When you start up your Java VM, you have to reference the .keystore file you created in order for your program to connect to the staging server. This is accomplished by passing the path to the keystore file in the command line parameter. If you are using Tomcat or another app server to connect to the staging server, then you must include this in the startup script for Tomcat. If it’s a desktop app, then this has to be passed to the script that launches the desktop app.

That’s pretty much it. Now that your Java VM can connect to the staging server, you can test out all the payments code using the LinkPoint API. Be sure in your code to point to the test server, and not the production server! The host name for the LinkPoint test server is “staging.linkpt.net”.

We do not just build mobile “apps”, we build mobile experiences

Let us build you mobile experiences for Android, BlackBerry, and iPhone. We can also build you cloud-connected experiences that span Mobile (Android, BlackBerry, iPhone), Web (Safari, Firefox, Internet Explorer) and Desktop (PC, Mac, Linux) for a truly connected real-time experience. See our work in action: download RainOrShine for BlackBerry and CityRyde for Android.

  • We provide full service, full lifecycle consulting services (planning, graphic design, architecture, marketing, support, and implementation).
  • We provide Architecture guidance before implementation; marketing strategy after implementation. Click here to learn more.

Zen Application Framework

All our applications are built using our Zen Application Framework, which helps you avoid the common pitfalls around mobile development. Zen drastically reduces development time & cost for mobile, web, and desktop experiences. Click here to learn more.

Our training services make You self-sufficient & sustainable

Want to learn from the best? We offer Android and BlackBerry developer training programs. Whether you are just starting out, or want advanced training, we have courses for different skill levels & technology requirements. Contact us to learn more, and sign up.

Our values: Open-source. Democratization of knowledge. To lead, never follow

We are leaders in mobile technology. We have done and seen it all. We do not follow trends set by others & we do not make the mistakes made by others. We set the trends for mobile because we are mobile visionaries.


Comments are closed.