These days, payments can be done multiple ways: EMV, credit, mobile wallets (Apple Pay, Android Pay, etc.), to name just a few.
This flexibility of payment options is great in most respects, but it creates challenges for developers. How can they write a single app that integrates all payment options? And how can they keep transactions secure, no matter which type of payment method their applications use?
The triPOS Cloud API is a tool that can help answer these questions. It provides access to a turnkey payment processing solution that supports all major payment methods, including EMV, credit, PIN debit and mobile wallets (Apple Pay, Android Pay, etc.). The triPOS Cloud interfaces with custom business management software via a REST API.
This tutorial provides an overview of integrating with triPOS Cloud payment processing and Express, a server-side web service. You will learn how to quickly process a payment transaction using a specific REST API.
The Payment Processing Environment
The triPOS Cloud payment processing environment contains the following elements, as illustrated in Figure 1:
- triPOS Cloud - the API
- Merchant environment - POS, router and PIN Pad
- Express Gateway - API gateway
By using the API during certification, a physical PIN pad is not necessary. A null simulator can replace the PIN Pad. However, you still need an Express test account to interact with the Express Gateway.
We will now discuss how you can process a sample sale request within minutes.
Step 1: Apply for an Express account
First, apply for an Express test account at http://www.elementps.com/Create-a-Test-Account. This will give you the account information to add to the headers of your API request.
After your application is accepted, you will receive the following account information to add to the headers of your API request:
You will also receive the Express test URLs and other important documentation for working with the triPOS Cloud and Express gateway.
Step 2: Build your API request with a REST client
To build the API request, we will use a third-party REST client: the Advanced REST client (ARC).
The triPOS Cloud accepts JSON-formatted request messages and returns responses in the same format as the request.
Each request is identified by a transaction type and is accompanied by data elements belonging to the request. Keep in mind that a typical triPOS Cloud request is simpler than an Express request because card information is not included. Card information is obtained downstream via direct interactions between triPOS Cloud and the PIN pad.
Each request requires a header with specific fields:
- If the request is a POST/PUT request, it needs parameters to be sent in the request body.
- For GET and DELETE, any parameters will be sent up in the URL’s query string.
- For any type of request, some values such as PaymentType may be sent in the URL. For more info, see the API documentation.
In Step 1, you received the values for building the API request header. Build the header as shown in Figure 2 under the ARC Headers tab.
To build the API body, you have to switch to the ARC Body tab as shown in Figure 3.
Construct the request as shown in Figure 3.
Step 3: Run your API request with the REST client
Run your API request by simply clicking the Send button in the upper right corner.
Step 4: Analyze the response
If everything is successful, an HTTP-200 response is returned, as shown in Figure 4.
Now run the request a second time.
You will get an HTTP-400 response as shown in Figure 5, because your request-id should be unique with every request you make.
But how can we make a valid request-id/UUID?
With the Online UUID Generator Tool (use version 1) we can retrieve a valid UUID. When adding this in the request it will give a successful response.
Let’s change the request URL to the production URL (https://tripos.vantiv.com/api/v1/sale) and run the request again.
The response will be an HTTP-401 as seen in Figure 6.
This is expected because you have a test account, not a production account, and you are therefore not authorized to use the API in production.
We successfully processed a sample sale request and also discussed the main error messages you can expect when the sample sale request is not correct. This quick review showed you just a small bit of the triPOS Cloud API. The triPOS cloud API is further described in this Swagger specification.
About the Author:
Cordny Nederkoorn is a software testing and marketing consultant with over 10 years of experience in finance, e-commerce and web development. He is also the founder of TestingSaaS, a testing and marketing agency for companies related to Software as a Service (SaaS).