The secux-paymentkit-sample-for-springtrees-ios is a sample APP for showing how to scan the QRCode from P22 and confirm the promotion / payment / refill to the P22 device via secux-paymentkit-v2.
- Minimum SDK Version: 21
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.secuxtech:secux-paymentkit-v2-android:{version}'
implementation 'com.github.secuxtech:secux-paymentdevicekit-v2-android:2.1.10'
}
Add permission to the AndroidManifest.xml
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
Request permission
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (this.checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1);
}
}
import com.secuxtech.paymentkit.*;
Use SecuXAccountManager object to do the operations below
private SecuXAccountManager mAccountManager = new SecuXAccountManager();
- Merchant login
Must login the assigned merchant account before calling payment related APIs.
Note: Login session is valid for 30 minutes. To continue use after 30 minutes, relogin is required.
SecuX Server API: /api/Admin/Login
Pair<Integer, String> loginMerchantAccount(String accountName, String accountPwd)
accountName: Merchant account name.
accountPwd: Merchant account password.
The first return value shows the operation result. If the result is SecuXRequestOK,
registration is successful, otherwise the second return value contains an error message.
Pair<Integer, String> ret = mAccountManager.loginMerchantAccount(name, pwd);
if (ret.first == SecuXServerRequestHandler.SecuXRequestOK) {
return true;
}
Log.i("", "Login merchant account failed! error:" + ret.second);
Use SecuXPaymentManager object to do the operations below
SecuXPaymentManager mPaymentManager = new SecuXPaymentManager();
- Get store information
Get store information via the hashed device ID in P22 QRCode.
SecuX Server API: /api/Terminal/GetStore
Pair<Pair<Integer, String>, SecuXStoreInfo> getStoreInfo(String devIDHash)
devID: Hashed device ID from getDeviceInfo function
The first return value shows the operation result. If the result is SecuXRequestOK,
getting store information is successful, the second SecuXStoreInfo contrains store
information, otherwise the first return string value contains an error message.
Note: if the first return result is SecuXRequestUnauthorized,
the login session is timeout, please relogin the system.
Pair<Pair<Integer, String>, SecuXStoreInfo> storeInfoRet = mPaymentManager.getStoreInfo(mDevIDhash);
- Do check-in / promotation / payment / refill operation
Confirm the promotation/payment/refill operation to the P22 device.
2.1 SecuX Server API:
-
Login operator account /api/Admin/Login
-
Encrypt operation data /api/B2B/ProduceCipher
2.2 SecuX Device APIs:
Please refer to the secux_paymentdevicekit for the APIs below:
-
Get P22 ivKey API
-
Cancel operation
-
Send encrypted operation data to P22 API
SecuX, maochunsun@secuxtech.com
SecuXPaymentKit is available under the MIT license.