Fazpass-Android
This is the Official Android wrapper/library for Fazpass OTP API, that is compatible with Gradle. Visit https://fazpass.com for more information about the product and see documentation at http://docs.fazpass.com for more technical details.
Installation
Please add this line into your gradle
implementation 'https://github.com/fazpass/fazpass-android-sdk'
Usage
import com.fazpass.otp.Fazpass
// initialize an object
val m = Fazpass.initialize(MERCHANT_KEY)
//Generate your otp
m.setGateway(GATEWAY_KEY)
m.generateOtp(PHONE_NUMBER) { response->
//@TODO
}
Response Attribute
When generating otp was success, the response is an object with this structure
data class GenerateOtpResponse(
var status:Boolean,
var message:String,
var error:String?,
var phone:String?,
var data: GenerateOtpData?
)
data class GenerateOtpData(
var id: String?,
var otp: String?,
var otp_length: String?,
var channel: String?,
var provider: String?,
var purpose: String?
)
We already serve it.
Validation
m.verifyOtp(OTP_ID, OTP){ status->
Log.v("Status: ","$status")
}
Template
If you feel lazy to create your validation page, we also have our validation page. Only need one line and let us handle the verification
val m = Fazpass.initialize(MERCHANT_KEY)
m.setGateway(GATEWAY_KEY)
m.generateOtp(PHONE_NUMBER) { response->
Fazpass.LoginPage(this, response)
}
It looks like this
Conclusion
We will try to always make it simple and secure