Thepeer Android SDK gives one integration access to all fintech businesses on your Android App
- Send
- Checkout
- Direct Charge
Send.money.mov
Direct.charge.mov
Checkout.mov
To your root build.gradle file add:
allprojects {
repositories {
mavenCentral()
}
}
To your app-level build.gradle file add:
dependencies {
// ...
implementation "co.thepeer:thepeer-android:[version]"
}
<meta-data
android:name="co.thepeer.PublicKey"
android:value="YOUR_PUBLC_KEY" />
KOTLIN
//initialize Thepeer SDK
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
//initialize Thepeer SDK
val thepeer = Thepeer.Builder(
activity = this,
amount = BigDecimal(10000.00),
currency = "NGN",
userReference = getString(R.string.user_reference),
resultListener = resultListener
).setMeta(mapOf("remark" to "Enjoy")).build()
}
JAVA
//initialize Thepeer SDK
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//initialize Thepeer SDK
Thepeer thepeer =new Thepeer.Builder(
this,
new BigDecimal("1000.00"),
"NGN",
getResources().getString(R.string.user_reference),
new ThepeerResultListener())
}
Parameter name | Description | Required |
---|---|---|
amount |
The amount you intend to send and must be pass as an integer in kobo | true |
currency |
Currency which can be "NGN" or "USD" |
true |
userReference |
The user reference returned by Thepeer API when a user has been indexed | true |
meta |
This object should contain additional/optional attributes you would like to have on your transaction response | false |
Initiate the send request by calling the below function
KOTLIN
thepeer.send()
JAVA
thepeer.send();
Initiate the checkout request by calling the below function
KOTLIN
thepeer.checkout(email: String)
JAVA
thepeer.checkout(String email);
Initiate the Direct Charge request by calling the below function
KOTLIN
thepeer.directCharge()
JAVA
thepeer.directCharge();
Once the request is initiated the SDK will wait from response from the service and notify the App
via ThepeerResultListener
KOTLIN
private val resultListener = object : ThepeerResultListener {
override fun onSuccess(transaction: ThepeerTransaction) {
//Transaction Successful
Log.v(TAG, transaction.toString())
}
override fun onError(error: Throwable) {
//Transaction Error occured
Log.e(TAG, error.message)
}
override fun onCancelled() {
//Transaction was cancelled
Log.e(TAG, " Cancelled")
}
}
JAVA
new ThepeerResultListener() {
@Override
public void onSuccess(@NonNull ThepeerTransaction transaction) {
((TextView) findViewById(R.id.resultText)).setText(transaction.toString());
}
@Override
public void onCancelled() {
}
@Override
public void onError(@NonNull Throwable error) {
}
}
If you're having trouble with Thepeer React or your integration, please reach out to us at [email protected]. We're more than happy to help you out.