The Smarter Way
Search…
⌃K

Android

​Ottu Checkout​

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.

​Features​

Simplified security:Sensitive data will be collected easily according to PCI-compliant, by sending it directly to Ottu.
Native UI: Ottu offers native screens and elements for collecting payment details.
Localized: We support the following localizations: English, Arabic.

​Privacy​

The Ottu Checkout SDK collects data to help us improve our products and prevent fraud. This data is never used for advertising and is not rented, sold, or given to advertisers.

​Requirements​

IDE to develop an android app. SDK is compatible with minimum SDK 22 and above.

​Getting started​

Firstly, you have to create session token by our public API, then SDK could be initialized To see more detail about our public API, navigate to the below link https://docs-ottu.gitbook.io/o/developer/rest-api/checkout-api​

​Installation​

Put below dependency into your Gradle.
Java
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.ottuco:ottu-android-private-sdk:1.0.10'
}

​Sample code​

Below is the sample code of how you can use Ottu Payment SDK.
Java
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();
Java
@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
textView.setText(paymentResult.message);
textView.setText(paymentResult.order_no);
textView.setText(paymentResult.operation);
}
​
}
}
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
if(paymentResult.status.equals("success")){
Intent intent = Intent(PAYMENT_SUCCESS)
sendBroadcast(intent)
}
}
}
}
​
// 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. Java
-keep class Ottu** { *; }
​
Last modified 24d ago