The smarter way
Search
K

Android

Over The Ottu Checkout which is Android SDK, helps you to make your payment process easy and quick within your Android app, in addition it provides UI screen and elements customizable empowering you to collect payment details of your user.
For optimal security, call REST APIs from server-side implementations, not client-side applications such as mobile apps or web browsers.

Features

Simplified security: Sensitive data will be collected easily according to PCI-compliant, by sending it directly to Ottu instead of sending it to your server.
Native UI: Ottu offers native screens and elements for collecting payment details.
Localized: Both English, Arabic localizations are supported.

Privacy

The Ottu Checkout SDK collects data to help in improving the products and services and prevent fraud. This data is never used for advertising and is not rented, sold, or given to advertisers.
IDE is required to develop an android app. SDK is compatible with minimum SDK 22 and above.
Firstly, a session token should be created by Ottu public API, then SDK could be initialized. See Rest API.
For "Api_Key" API Public key sohuld be used.
Put below dependency into your Gradle.
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.ottuco:ottu-android-private-sdk:1.0.10'
}
Below is the sample code of how you can use Ottu Payment SDK.
Ottu ottuPaymentSdk = new Ottu(MainActivity.this);
ottuPaymentSdk.setApiId("Api_Key"); // set Api Key which is get from Ottu merchant account
ottuPaymentSdk.setMerchantId("Merchant_Id");
ottuPaymentSdk.setSessionId("Session_id"); // Retrive from public API
ottuPaymentSdk.setAmount("100.00"); // String Value
ottuPaymentSdk.setLocal("en"); // en or ar
ottuPaymentSdk.build();
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK ){
if (requestCode == OttuPaymentResult ){
SocketRespo paymentResult = (SocketRespo) data.getSerializableExtra("paymentResult");
String Status = paymentResult.getStatus();
if (Status.equals("success")){
// handle success result
textView.setText(paymentResult.status);
textView.setText(paymentResult.message);
textView.setText(paymentResult.order_no);
textView.setText(paymentResult.operation);
}else if (Status.equals("failed")){
// handle failed result
} else if (Status.equals("cancel")){
// handle cancel result
}
}
}
}
if you are using fragments you will need to add broadcastReseiver in OnActivityResult to add your success-failure logic in your fragment.
PAYMENT_SUCCESS = "paymentSuccess" // add in your constant accordingly
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK ){
if (requestCode == OttuPaymentResult ){
SocketRespo paymentResult = (SocketRespo) data.getSerializableExtra("paymentResult");
textView.setText(paymentResult.status); // success || failed || cancel
String Status = paymentResult.getStatus();
if (Status.equals("success")){
// handle success result
Intent intent = Intent(PAYMENT_SUCCESS)
sendBroadcast(intent)
}else if (Status.equals("failed")){
// handle failed result
} else if (Status.equals("cancel")){
// handle cancle result
}
}
}
}
// register your broadcast
activity.registerReceiver(
paymentReceiver,
IntentFilter(PAYMENT_SUCCESS)
)
// then you will receive it in your fragment with your action PAYMENT_SUCCESS
BroadcastReceiver paymentReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction().equals(PAYMENT_SUCCESS)){
// add your code
}
}
};

ProGuard

You may need to include the following lines in your progard-rules.pro file if enable progard or minifyEnble.
-keep class Ottu** { *; }
Last modified 6mo ago