Clone wiki

Momoe App SDK / Integration Document

Momoe App Integrator (v0.0.1)

Introduction

This Android project allows other Android apps to integrate with Momoe Express seamlessly.

Flow

The app which wants to integrate with Momoe App (referred as merchant app) makes a request to Momoe App. Momoe App presents with a dialog box where the use can pay. If the user does not have Momoe the user is prompted to install Momoe.

How to integrate

1. Add the dependency to your build.gradle

Add the Integrator dependency to your build file. Ensure correct repository is also added.

repositories {
    maven {
        url 'https://dl.bintray.com/momoe/maven/'
    }
}

dependencies {
    compile "in.momoe:app-integrator:0.0.1"
}

2. When the user selects pay with Momoe make the request

When the user clicks a button (The UI is up to you) to pay with Momoe. Make a call to the Momoe App for payment.

MomoePaymentRequest.getRequestBuilder(YourActivity.this)
        .setMerchantId("your-momoe-merchant-id")
        .setOrderId("your-order-id")
        .setAmount(200f)
        .request();

This will fire the request and direct the user to Momoe App (If installed) otherwise prompt the user to install Momoe first.

Override onActivityResult to intercept the result of the request.

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    MomoePaymentResponse response = MomoePaymentResponse.parse(requestCode, resultCode, data);
    if (response != null) {
        // this is a valid response from Momoe App
        if (response.isSuccess()) {
            // The user has made a successful payment
            // Proceed to a confirmation screen for the payment, your server
            // would have received a callback from Momoe indicating the same.

            String momoeTxnId = response.getTxnId();
            String orderId = response.getOrderId();
        }
    }
}

Momoe will callback your server for all payments (the doc for this is at the end). If your server has not received a call from Momoe you can query Momoe with the orderId you passed in to the request (doc is at the end). In any case you should not consider a payment successful without a confirmation from Momoe server.

If you do not have your Momoe Merchant ID please contact your Momoe representative.

Updated