# Getting started with SPI

In this document you will find the necessary information to implement Payment and Security SPI to connect your Card Reader with PCS.

# Download SPI Development Kit

You can start with Payment and Security SPI Services without the necessary OS changes. You can simply install the SPI Test tool along with the Poynt Services and Poynt Capability Manager applications to begin your integration.

  1. Download SPI Development Kit (opens new window).
  2. Extract the downloaded file and install the application on your Android based terminal.
    1. adb install -r PoyntServices.apk
    2. adb install -r PoyntCapabilityManager.apk
    3. adb install -r SPITestTool.apk
  3. Once install continue with the rest of the steps below.

# Setting up your Android Project

Payment SPI and Security SPI services must be built as Android services implementing the corresponding AIDL interfaces defined in Poynt Vendor SDK.

You can add these services to an existing Android Application (eg. typically as part of vendor SDK Service) or as a new application. Below you will find the steps to add the necessary dependencies and skeleton code.

You can use the sample android project as the starting point with the necessary hooks: Sample SPI Service (opens new window).

# Add SDK Dependencies

In your build.gradle, please add the following maven repository and library dependencies:

allprojects {
    repositories {
        ....
        ....
        maven {
            url 'https://nexus.poynt.com/content/repositories/releases'
        }
        maven {
            url 'https://nexus.poynt.com/content/repositories/snapshots'
        }
        ....
        ....
    }
}

And add dependencies for the following three android libraries:

 implementation 'co.poynt.android.sdk:poynt-sdk:<current-version>@aar'
 implementation 'co.poynt.android.sdk:vendor-sdk:<current-version>@aar'
 implementation 'com.google.code.gson:gson:2.8.2'

# Implement Payment SPI Service

Implement Payment SPI Service as an android service and implement the binder as IPoyntPaymentSPI.

private final IPoyntPaymentSPI.Stub mBinder = new IPoyntPaymentSPI.Stub() {
	// implement all methods in the interface
}

# Implement Payment Security SPI Service

Implement Payment Security SPI Service as an android service and implement the binder as IPoyntPaymentSecuritySPI.

private final IPoyntPaymentSecuritySPI.Stub mBinder = new IPoyntPaymentSecuritySPI.Stub() {
	// implement all methods in the interface
}

# Add receiver for EMV Configuration changes

To receive the broadcast events from Poynt Configuration Service you would need to add an android broadcast receiver and register it in your Android Manifest file or programmatically for the following broadcasted events.

<receiver
            android:name=".EmvConfigsUpdateReceiver"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="poynt.intent.action.EMV_CONFIGS_UPDATED" />
            </intent-filter>
        </receiver>

And inside your broadcast receiver, add code to connect to Poynt Configuration Service to fetch the information you would need to load into your Card Reader.

Refer to Sample SPI Service (opens new window) for sample code that you can use as a starting point.

# Integrate with your Card Reader

At this point you can start integrating with your Card Reader either through your existing Android SDK or through system or native services.

Please follow through the Payment SPI to identify the necessary integration points.

Last Updated: 10/2/2020, 3:34:24 PM