Ola Money Developer Hub

Welcome to the Ola Money developer hub. You'll find comprehensive guides and documentation to help you start working with Ola Money as quickly as possible, as well as support if you get stuck.


Auto Read OTP

Why not delight your customer with our auto read OTP feature on android? Here is how you can do that:

Step 1: Add a permission to receive SMS

<uses-permission android:name="android.permission.RECEIVE_SMS"/>

Step 2: SMS receiver

Copy this SMS receiver onto your web view containing activity.

private BroadcastReceiver smsReceiver = new BroadcastReceiver() {
    public void onReceive(Context context, Intent intent) {
        Bundle bundle = intent.getExtras();
        SmsMessage[] smsMessages = null;

        if (bundle != null) {
            Object[] pdus = (Object[]) bundle.get("pdus");
            smsMessages = new SmsMessage[pdus.length];

     for(int i=0;i<smsMessages.length;i++) {
         smsMessages[i] = SmsMessage.createFromPdu((byte[])pdus[i]);
         String sender = smsMessages[i].getOriginatingAddress();
            if(sender.contains("OLAMNY") || sender.contains("olamny")) {
                    String message = smsMessages[i].getMessageBody();
                    String otp = extractOTP(message);
                    if(otp!=null) {
                        String js = "javascript: " + "document.getElementById('sample2').value = '"+otp+"';"
                                            + "document.getElementsByClassName('mdl-button')[0].click();";

                        if(webView!=null) {

public String extractOTP(String sms) {
    String[] nbs = sms.split("\\D+");
    if (nbs.length != 0) {
        for (String number : nbs) {
            if (number.matches("^[0-9]+$")) {
                return number;
    return null;

Step 3: Make a fancy Waiting box. Here is one if you need it:

private ProgressDialog showDialog() {
    ProgressDialog pd = new ProgressDialog(WebViewActivity.this);
    pd.setTitle("Waiting for SMS");
    return pd;

Step 4: Remember to register the smsReceiver as follows:

IntentFilter intentFilter = new IntentFilter(Telephony.Sms.Intents.SMS_RECEIVED_ACTION);
registerReceiver(smsReceiver, intentFilter);

You can unregister the same on onDestroy() of the activity:


Updated about 14 hours ago

Auto Read OTP

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.