Positive Integration
POSitiveLib provides an easy-to-use API interface to initiate card transactions, in a java library.
Positive is an Android Based Payment Application integrated to Hips Payment Gateway. You can integrate with positive in two ways to launch a payment request window.
- Via API (weblink RESTi) start payments from another device (POS System) API Swagger Postman collection
- Via App-to-App commands (IPC comms) start payment from another App in the terminal.
Demo app
A920 / IM30 3rd Party Integration
This guide provides the instructions for the POSitiveLauncher demo application required for 3rd party developers to write applications that integrate with POSitive on the Pax A920 / IM30 payment terminal.
Prerequisites
- A Pax A920 / IM30 payment terminal.
- A USB cable (USB-A to USB micro-B).
- The terminal must be installed with at least version of the POSitive payment application, ideally configured in demo mode to assist development.
- The terminal must be put into debug mode using the Pax Engine (ask Hips for access)
POSitive Launcher–Sample Application
- Unzip and import the POSitiveLauncher package into Android Studio.
- The application provides a very simple program that will allow you to see how a transaction and a reversal should be performed. Test buttons are provided on the main activity (see MainActivity.java)
- Comments have been added in the code to explain how it works, but it should be quite self-explanatory
- The code relies on a library that is included called POSitivelib-X.X- release.aar. Look at the manifest and the build.gradle files to see how it is integrated.
- The IPC comms rely on a BroadcastReceiver being used to send/receive the messages. Look at the manifest to see how this should be declared. The example implementation is in TestLaunchReceiver.java
- It is the responsibility of the calling app to return itself to the foreground once the transaction is completed (The sample app also does this in the POSitiveLauncReceiver by calling startActivity() once the result has been received)
In Summary: you should be able to declare a receiver and use the included library to do IPC comms to and from the POSitive app (Using this app as a working example)
Terminal Profile
There is a config file on the terminal called profile.json. This file determines which
apps are on display from the main menu. This file is delivered to the terminal through the resource packages.
The app being developed must be added to the resource package for each customer.
{
"displayName": "POSitive Demo", "packageName": "com.eft.positivelauncher"
}
Please provide this information to Hips and ask for an updated resource package to be sent to the development terminal.
Integration Rules
-
The apps must not bring down the network stack. Both the payment application and the paxstore app require internet connectivity to upload transactions in the background.
-
New applications must not install themselves as a launcher process
Transaction Initiation
To initiate a transaction, call the API functions on the PosIntegrate class. The
methods take additional configuration, passed in as a HashMap to the function.
The HashMap is populated with additional values identified by the enum CONFIG_TYPE on PosIntegrate.java
Declarations:
PositiveError executeTransaction(Context context, TRANSACTION_TYPE transType, HashMap<CONFIG_TYPE, String> args)
PositiveError executeReversal(Context context, HashMap<CONFIG_TYPE, String> args)
Example:
This will add an amount to the hashmap of 100 (minor units):
HashMap<CONFIG_TYPE, String> args = new HashMap<CONFIG_TYPE, String>(); args.put(CT_AMOUNT, "100");
PosIntegrate . executeTransaction (this, TRANSACTION_TYPE_SALE, args);
PosIntegrate . executeTransaction (this, 100, TRANSACTION_TYPE_REFUND, args);
PosIntegrate .executeReversal(this, args);
PosIntegrate . executeTransaction (this, TRANSACTION_TYPE_SALE, args);
PosIntegrate.queryTransaction(this.args);
Reverse transactions based on their UTI, or just reverse the last transaction by passing in a receipt number of 0.
Pass additional arguments to disable printing, and keep the reversal silent (in the background)
Cancel Transaction takes CT_CANCELLED_TIMEOUT as part of argument to cancel the transaction after the entered time.
Purchase With Cashback: The sale transaction will offer cashback where the terminals configuration indicates that cashback is supported for the card type presented. If you want to enable\disable this feature use paxstore to update your terminals settings. You can also pass in a cashback or gratuity amount and the app will use it if allowed by the card.
Transaction Results
Different results can come back from the POSitive app based on the transaction
result.
The following method is used to unpack the results into an object.
PositiveTransResult unpackResult(Context context, Intent intent)
The results on the object are split into four separate lists, with a flag that can be
checked on the object to indicate if the list is present.
Examples:
- For a successful CTLS (contactless) transaction, lists 1-3 would be returned.
- For a successful MSR (magnet swipe) transaction, lists 1 and 2 would be returned.
- For a critical failure resulting from a crash or a programming error then list 4 would be returned.
- List One is returned when the transResponse boolean = true
- List Two is returned when the transDetails boolean = true
- List Three is returned when the cardType String = “EMV” or “CTLS”
- List Four is returned when there is a serious failure and transResponse = false;
The broadcast receiver has code to demonstrate extracting the results for the calling app to use.
List One - Standard Response Details (transResponse = true)
Field Name | Date Type | Description |
---|---|---|
UTI | GUID | Unique Transaction Identifier (e.g. 5594801e-a3e5-da11-8b4600065b3e6c8d) |
amountTrans | long | Amount of the transaction (minor units, 100 = £1.00) |
amountGratuity | long | The tip amount (minor units, 100 = £1.00) |
amountCashback | long | The cashback amount (minor units, 100 = £1.00) |
transApproved | Boolean | Transaction result |
transCancelled | Boolean | Set when the user manually cancels the transaction. |
cvmSigRequired | Boolean | Indicator to let called know if signature is required |
cvmPinVerified | Boolean | Indicator to say if the pin was verified |
transCurrencyCode | String | 3 character currency code (GBP/EUR etc) |
terminalId | String | The terminal soft ID (e.g. 12345678) |
merchantId | String | The merchant ID (e.g. 123456789012345) |
softwareVersion | String | The software version (e.g. 1.00.00) |
List Two (transDetails = true)
Field Name | Data Type | Description |
---|---|---|
retrievalReferenceNumber | String | The retrieval reference number (matches the RRN for the protocol being used) |
responseCode | String | The response code from the acquirer (e.g. 00 = Approved) |
stan | String | The stan used in the protocol messages |
authorisationCode | String | The auth code returned from the acquirer (e.g. 123ABC) |
merchantTokenId | String | Token from the gateway (if sent) |
cardPan | String | The masked pan of the card (e.g. 545454**5454) |
cardExpiryDate | String | The expiry date of the card used – YYMM |
cardStartDate | String | The start date of the card used (if available) – YYMM |
cardScheme | String | The name of the scheme used (e.g. Visa\Mastercard) |
cardPanSequenceNumber | String | The pan sequence number (e.g. 001) |
cardType | String | The capture method of the card (EMV/MSR/Contactless/Manual) |
List Three - EMV Details
Field Name | Data Type | EMV tag data | Description |
---|---|---|---|
emvAid | String | 9f06 | The application identifier (e.g. A0000000031010) |
emvTsi | String | 9b | Transaction Status Information (e.g. E800) |
emvCardholderName | String | 5f20 | The cardholder name (if available, e.g. P CLARKSON) |
emvCryptogram | ByteArray | 9f26 | The cryptogram used (e.g. 8754EA78EB65AB65) |
emvCryptogramType | String | Derived from 9f27 | The type of the cryptogram (e.g. AAC/TC/ARQC) |
List Four – Error Details
Field Name | Data Type | Description |
---|---|---|
TransResponse | Boolean | Always false as there has been an error |
Approved | Boolean | Always false as there has been an error |
Error | Enum | See the PositiveErrors enum type in the library |
ErrorText | String | Additional error information |
Transaction Reports
To initiate a report, call the following API function on the PosIntegrate class.
The HashMap is populated with the report type
PositiveError executeReport(Context context, TRANSACTION_TYPE transType, HashMap<CONFIG_TYPE, String> args)
PositiveError unpackReport(Context context, Intent intent)
HashMap<CONFIG_TYPE, String> args = new HashMap<CONFIG_TYPE, String>(); args.put(CT_XREPORT, "TRUE");
PosIntegrate.executeReport(this, TRANSACTION_TYPE_RECONCILIATION, args);
PosIntegrate . executeReport (this, args);
PosIntegrate . unpackReport (content, intent);
The report should be printed by the terminal and the results returned to the broadcast receiver. The unpackreport method can be used to extract the results into an object.
Status Events
There are different status events declared in POSitive app.
Different events can come back from the POSitive app based on the transaction events.
Filter TRANSACTION_STATUS_EVENT in onReceive() of the PositiveLaunchReceiver and receive the status events using below code:
String statusEvent = intent.getStringExtra("StatusEvent");
List of Status events:
- Transaction started
- Transaction Approved
- Transaction Declined
- Card type = MSR
- Card type = EMV
- Card type = CTLS
- Card type = manual
- Transaction Cancelled
- Transaction Referred
- Transaction Finished
- GetCard Screen Displayed
- Manual Pan Screen Displayed
- Pin Requested(Offline)
- Pin Requested(Online)
- Host Approved
- Reversal Approved
- Reversal Declined
- Transaction Declined
- Card User Cancelled
- Printer General Error
- Printer Out Of Paper
- Amount High
- Amount Low
- Card Blocked
- Card Expired
- Pin Invalid Retry
- Pin Invalid Last Try
- Cashback Too High
- Pin Cvm Required
- Signature Cvm Required
- Locally Declined
- Host Declined
- Issuer Declined
- Issuer Unavailable
- Update In Progress Error
- Update Required Error
- Reversal Not Possible Error
- Transaction Type Not Allowed
- Login Failed
- Chip Unreadable
- Chip App Unsupported Please Swipe
- Chip Rid Unsupported Please Swipe
- Chip Invalid Please Swipe
- Chip not allowed Please swipe
- Chip detected Please Insert
- Chip detected Please Insert OR Force Fallback
- Insert Or Swipe Card
- Magnetic Strip Unreadable
- Magnetic Stripe Invalid
- Magnetic Stripe Not Allowed
- Manual Input Invalid
- Manual Input Invalid Length
- Manual Input Invalid Date
- Cashback Only Allowed Online
- Transaction Only Allowed Online
- Approval Code Invalid
- Password Invalid
- Close Batch Required
- Close Batch Not Required
- Technical Error
- Hardware Error
After getting results back from the POSitive app , there are options to view transaction results and status events.
Updated almost 4 years ago