Postępuj zgodnie z tym przewodnikiem, aby zintegrować bramkę płatności SIBS z aplikacją na Androida za pomocą naszego pakietu SDK.
Step 1: SDK installation
- Download this file: android-sibs-stargate-sdk-0.1.1
- Copy the simply-connect-sdk.aar file to the app/libs folder in your project.
- Inside the “dependencies” section of your app/build.gradle file, implement the following:
//native / https request
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation "androidx.appcompat:appcompat:1.6.0"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1"
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7'
implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
//retrofit / https request
implementation "com.squareup.okhttp3:okhttp:4.10.0"
implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0'
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
//gson
api 'com.google.code.gson:gson:2.10.1'
//google wallet
api "com.google.android.gms:play-services-wallet:19.3.0"
api 'com.google.android.gms:play-services-base:18.4.0'
Step 2: SIBS SDK initialization
Initializing the SIBS SDK authenticates you as a merchant. Include the following parameters before sending any further requests.
Parameters
- clientId – client identifier used to authenticate.
- accessToken – access token used to authorise requests.
- environmentSDK – environment in which the SDK will operate.
Signature
start(clientId: String, accessToken: String, environmentSDK: EnvironmentSDK)
Step 3: SDK requests
StartPayment
Starts a payment process with the transaction parameters provided. Starts the payment flow and returns the result asynchronously via LiveData.
Parameters:
- actvity – the AppCompatActvity from which the payment flow is initiated. This ensures proper lifecycle and user interface management.
- transactionParamsSDK – the parameters needed to process the payment transaction.
Response:
Returns a LiveData object containing the result of the transaction, which can be watched for updates as the payment process is completed.
Signature:
startPayment(activity:AppCompatActicity,transactionParamsSDK:TransactionParamsSDK):LiveData
GetTransactionStatus
Recovers the status of a previously initiated transaction. Queries the status of the transaction by its ID and returns the result asynchronously via LiveData.
Parameters:
Receives the parameter transactionId. The unique identifier of the transaction to be queried.
Response:
Returns a LiveData object containing the status of the transaction, which can be watched for updates.
Signature:
getTransactionStatus(transactionId: String): LiveData<TransactionStatusSDK>
Data Classes
EnvironmentSDK:
enum class EnvironmentSDK {
QUALITY,
PRODUCTION
}
Response:
TransactionResultSDK:
class TransactionResultSDK(
val isSuccess: Boolean,
val transactionID: String?,
val paymentType: String?,
val paymentStatus: String?,
val paymentMethod: String?,
val returnStatus: ReturnStatus?,
val execution: Execution?,
val merchant: Merchant?,
val token: Token?,
val sdkError: ErrorStatusSDK? = null,
)