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:
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”.