Generate a triPOS Request

Document created by matthew.milner on May 9, 2016Last modified by matthew.milner on Jun 1, 2016
Version 8Show Document
  • View in full screen mode

This document illustrates the steps necessary to process a transaction through triPOS. The API supports null lane IDs that allows payment transactions to flow through the system without the need for hardware, however developers will likely want to obtain hardware peripherals for end-to-end testing as well as test credit cards. Developers should reference the PIN pad Setup and the triPOS configuration file located in the root of the installation directory to confirm proper setup. During the initial triPOS install, additional configuration may be needed before using it for the first time.

 

Note To change the triPOS.config settings after installation, use the available endpoints documented under http://localhost:8080/help

 

Below is a brief explanation of some important EMV default values in the triPOS.config file. We recommend that you do not change any of these values without consulting the Certification Team.

 

terminalCapability

The default value for this field enables the following Cardholder Verification Methods (CVMs): online PIN, offline plaintext PIN, offline enciphered PIN and none.

ridConfiguration/aidConfiguration

These sections hold the necessary configuration to define which brands are supported. The default configuration supports the following brands: Visa, Visa Electron, Visa Interlink, Visa US debit, MasterCard, Maestro, MasterCard/Maestro US debit, Discover, Discover US debit and AmericanExp

 

 

Step 1: Generate a request package

 

You can generate either an XML or JSON request. This example shows the JSON request. Also notice that the value in laneId is 9999. This is the “null” laneId that allows a transaction to flow through the system without hardware. All lanes are configured in the triPOS.config file located at: C:\Program Files (x86)\Vantiv\triPOS Service (if you kept the default installation directory). If you modify this file make sure to restart the triPOS.NET service in the Services app to read in your latest triPOS.config changes.

 

{ 
“address”: { 
“BillingAddress1″: “123 Sample Street”, 
“BillingAddress2″: “Suite 101″, 
“BillingCity”: “Chandler”, 
“BillingPostalCode”: “85224″, 
“BillingState”: “AZ” 
}, 
“cashbackAmount”: 0.0, 
“convenienceFeeAmount”: 0.0, 
“emvFallbackReason”: “None”, 
“tipAmount”: 0.0, 
“transactionAmount”: 3.25, 
“clerkNumber”: “Clerk101″, 
“configuration”: { 
“allowPartialApprovals”: false, 
“checkForDuplicateTransactions”: true, 
“currencyCode”: “Usd”, 
“marketCode”: “Retail” 
}, 
“laneId”: 9999, 
“referenceNumber”: “Ref000001″, 
“shiftId”: “ShiftA”, 
“ticketNumber”: “T0000001″ 
}

 

 

Step 2: Create Message Headers

 

You will need the developer credentials e-mailed to you when you requested your test account.

 

AuthorizationHeader authorizationHeader =
AuthorizationHeader.Create(message.Headers, message.RequestUri, postBody,
message.Method.Method, “1.0″, “TP-HMAC-SHA1″, Guid.NewGuid().ToString(),
DateTime.UtcNow.ToString(“O”), developerKey, developerSecret);
message.Headers.Add(“tp-authorization”, authorizationHeader.ToString()); 
message.Headers.Add(“tp-application-id”, “1234″); 
message.Headers.Add(“tp-application-name”, “SendRequestAndViewReceipt”); 
message.Headers.Add(“tp-application-version”, “1.0.0″); 
message.Headers.Add(“tp-return-logs”, “false”); 
message.Headers.Add(“accept”, contentType); 
message.Content = new StringContent(postBody, Encoding.UTF8, contentType);

 

 

Step 3: Send the request to triPOS

 

Use any http library to send a request to triPOS which is listening on a local address: http://localhost:8080/api/v1/sale (if you kept the install default). View additional transaction types here.

 

HttpResponseMessage respMessage = null; 
using (var httpClient = new HttpClient()) 
{ 
var message = new HttpRequestMessage(HttpMethod.Post, new Uri(url)); 
this.CreateRequestHeaders(message, postBody, contentType, developerKey, developerSecret); 
Task response = httpClient.SendAsync(message); 
response.Wait(); 
respMessage = response.Result; 
}

 

 

Step 4: Receive the response from triPOS

 

Since the request was sent in JSON format, JSON format is returned from triPOS. Note that the approval is received from Vantiv, but that no confidential cardholder data is exposed to the application. This is because triPOS connected to the Express API, managing the transfer of encrypted card data outside of the POS application.

 

{ 
“cashbackAmount”: 0, 
“debitSurchargeAmount”: 0, 
“approvedAmount”: 3.25, 
“convenienceFeeAmount”: 0, 
“subTotalAmount”: 3.25, 
“tipAmount”: 0, 
“accountNumber”: “400300******6781″, 
“binValue”: “400300000000″, 
“cardHolderName”: “GLOBAL PAYMENTS TEST CARD/”, 
“cardLogo”: “Visa”, 
“currencyCode”: “Usd”, 
“entryMode”: “Swiped”, 
“paymentType”: “Credit”, 
“signature”: { 
“data”: “**[Removed]**”, 
“format”: “PointsBigEndian”, 
“statusCode”: “SignaturePresent” 
}, 
“terminalId”: “0000009999″, 
“totalAmount”: 3.25, 
“approvalNumber”: “000034″, 
“isApproved”: true, 
“_processor”: { 
“processorLogs”: [ 
"ProcessorResponseCode: **[Removed]**” 
], 
“processorRawResponse”: “**[Removed]**”, 
“processorReferenceNumber”: “Ref000001″, 
“processorRequestFailed”: false, 
“processorRequestWasApproved”: true, 
“processorResponseCode”: “Approved”, 
“processorResponseMessage”: “Approved” 
}, 
“statusCode”: “Approved”, 
“transactionDateTime”: “2015-01-21T14:34:21-08:0 0″, 
“transactionId”: “2004243943″, 
“_errors”: [], 
“_hasErrors”: false, 
“_links”: [ 
{ 
"href": "http://localhost:8080/api/v1/sale/2004243943/return/credit", 
"method": "POST", 
"rel": "return" 
} 
], 
“_logs”: [], 
“_type”: “saleResponse”, 
“_warnings”: [] 
}

 

 

Step 5: Parse the response data

 

Developers may parse the JSON or XML in any manner desired, but one easy way to parse the JSON is to use the JsonConvert.DeserializeObject method (from the Newtonsoft JSON nuget package), which de-serializes the textual response from triPOS into an object format that is easier to work with.

 

respObj = JsonConvert.DeserializeObject(actualResponse);
Vantiv Confidential and Proprietary
For Internal Use Only
b

 

 

Access our sample code on GitHub

1 person found this helpful

Attachments

    Outcomes