Skip to content

MathRoda/plutu-api-kotlin-client

Repository files navigation

Plutu Payments Gateway API Kotlin Client

Version Platform Kotlin 1.6.21

This library is written in Kotlin and provides a way to Implement Payments Gateway from Plutu.ly API. It uses Retrofit, and Kotlin coroutines.

Installation

  1. Add the following lines in your AndroidManifest.xml file
<uses-permission android:name="android.permission.INTERNET"/>
  1. Add it in your root build.gradle at the end of repositories:
allprojects {
		repositories {
			maven { url 'https://jitpack.io' }
		}
	}
  1. Add the dependency
dependencies {
	        implementation 'com.github.MathRoda:plutu-api-kotlin-client:$latest_version'
	}
  1. Create a new account to get your API keys Plutu

Usage

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"
    )

for more detailed implementation with structure handling and use cases read source code

About

Library to Implement payments gateway with Plutu for Android Native Development

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages