This library is written in Kotlin and provides a way to Implement Payments Gateway from Plutu.ly API. It uses Retrofit, and Kotlin coroutines.
- Add the following lines in your AndroidManifest.xml file
<uses-permission android:name="android.permission.INTERNET"/>
- Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
- Add the dependency
dependencies {
implementation 'com.github.MathRoda:plutu-api-kotlin-client:$latest_version'
}
- Create a new account to get your API keys Plutu
Plutu provides online payments gateways with Sadad / Edfali / Local Banks Cards.
Instantiate Retrofit service and proceed with the call:
private val retrofitBuilder = Retrofit.Builder()
.baseUrl(BaseUrl.PLUTU_URL)
.addConverterFactory(GsonConverterFactory.create())
.build()
object InstancePlutuService {
val sadadService: SadadService by lazy {
retrofitBuilder.create()
}
val adfaliService: AdfaliService by lazy {
retrofitBuilder.create()
}
}
val SadadPaymentGateway = InstancePlutuService.sadadService
/**
* this Function should be always called within a coroutine
*/
.sendOtp(
token = "Your Token",
apiKey = "Your API Key",
mobileNumber = "Sadad Mobile Number",
birthYear = "Year of Birth",
amount = "Amount in Libyan Dinars"
)