Overview
2C2P SoftPOS Application facilitates seamless integration with your Android application through direct app-to-app communication using Android Intents. This approach simplifies the process of initiating payment operations, managing device states, and retrieving transaction information directly from the SoftPOS application.
For streamlined development, 2C2P provides the poslib wrapper library. This library encapsulates the underlying Android Intent mechanisms and data structures, allowing developers to interact with the API using a more abstract and developer-friendly interface.
Quickstart: App-to-App Integration
This guide provides a quick overview of integrating your Android application with 2C2P SoftPOS App using the poslib wrapper library.
Prerequisites
1. Setup
Before you begin, ensure you have the following:
- Install 2C2P SoftPOS Application from the Google Play Store on your target Android device
- Install your merchant app on your target Android device
- MSA POS Lib: Include
MSA POS Lib v1.2.8
or newer in your project.
2. Gradle Setup
Follow the steps below to install the required dependencies
POS Lib
POS Lib is a wrapper library that wraps the APIs and data for ease of integration
In your machine/environment, set up the credential to download the required SDK package
# minesec client registry
MINESEC_REGISTRY_LOGIN=minesec-product-support
MINESEC_REGISTRY_TOKEN={token-value}
Please seek our team to retrieve the token value
Set Up
In your project, set up the maven registry as follow:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
// MineSec's maven registry
maven {
val MINESEC_REGISTRY_LOGIN: String? by settings
val MINESEC_REGISTRY_TOKEN: String? by settings
requireNotNull(MINESEC_REGISTRY_LOGIN) {
"""
Please set your MineSec Github credential in `gradle.properties`.
On local machine,
** DO NOT **
** DO NOT **
** DO NOT **
Do not put it in the project's file. (and accidentally commit and push)
** DO **
Do set it in your machine's global (~/.gradle/gradle.properties)
""".trimIndent()
}
requireNotNull(MINESEC_REGISTRY_TOKEN)
name = "MineSecMavenClientRegistry"
url = uri("https://maven.pkg.github.com/theminesec/ms-registry-client")
credentials {
username = MINESEC_REGISTRY_LOGIN
password = MINESEC_REGISTRY_TOKEN
}
}
}
}
dependencies {
// ... other deps
implementation("com.theminesec.app:poslib:1.2.8")
}
Usage
- Creating POS API
Pass along 2C2P SoftPOS app's package name to the MsaPosApi from the poslib:
private val posApi = MsaPosApi("com.ccpp.softpos.android")
- Check App Install Status
Started from android 11 (API level 30) or higher, you'll need to include the <query> in the manifest to query package info.
More on Android Developer Docs
<queries>
<package android:name="com.ccpp.softpos.android" />
</queries>
You may query to check if the application is installed on the target Android device
// require context for packageManager
// can pass in activity or compose view localContext
posApi.isSoftPosInstalled(context)
You are ready to begin integrating!
Once you have completed the above steps, you are now ready to begin integrating!
Updated 1 day ago