Skip to content

WibmoPay Payment Gateway

georgethomas-mypoolin edited this page Dec 4, 2019 · 13 revisions

Introduction

WibmoPay PG SDK (Wibmo Pay) Maven metadata URI

This is the documentation for integrating the WibmoPay payment gateway on your Android app.

Features

  • UPI
  • Cards
  • Wallets
    • Paytm
    • Mobikwik

Integration

WibmoPay PG Integration Steps in Android Studio

Step 1. Download Repository

Gradle

Add this to your project level build.gradle file in your studio project

buildscript {
  repositories {
     mavenCentral()
  }
}

Add this to your module level build.gradle file in your studio project

compile 'com.mypoolin:sdk-pg-lite:0.0.7'

Or

Maven

<dependency>
    <groupId>com.mypoolin</groupId>
    <artifactId>sdk-pg-lite</artifactId>
    <version>0.0.7</version>
</dependency>

Request Code [JAVA]

Request Parameters Type Mandatory
"merchantName" String Yes
"merchantAmount" String Yes
"merchantTxnId" String Yes
"merchantKey" String Yes
"payerName" String No
"payerMobileNo" String No
"merchantMessage" String No
"payerEmailId" String No
"merchantPaymentOption" String No
"callbackurl" String Yes
"checksum" String Yes
 Bundle pgBundle = new Bundle();
 pgBundle.putString("merchantName", <YOUR-MERCHANT-ID>); //req
 pgBundle.putString("merchantAmount", "1.00");  //req
 pgBundle.putString("merchantTxnId", <UNIQUE-TRANSACTION-ID>);//req
 pgBundle.putString("merchantKey", <YOUR-MERCHANT-KEY>); //req
 pgBundle.putString("payerName", ""); // optional
 pgBundle.putString("payerMobileNo", ""); // optional
 pgBundle.putString("merchantMessage", "");// optional
 pgBundle.putString("payerEmailId", ""); // optional
 pgBundle.putString("merchantPaymentOption", "paytm,mobikwik,upi,cards"); // optional 
 // comma seprated values to enable mode of payments
 //ALLOWED options are 
 /*paytm,
 mobikwik,
 upi,nb
 cards*/
 pgBundle.putString("checksum", sha1(<YOUR-MERCHANT-ID>|<UNIQUE-TRANSACTION-ID>|<AMOUNT>|<YOUR-MERCHANT-KEY>)); //req
 pgBundle.putString(SDKConstants.KEY_REQUEST_PARAM_MERCHANT_CALLBACK_URL, ""); //req  //dummy url  
 // PRODUCTION  https://pgupi.wibmopay.com/callback
 // TEST  https://testpgupi.wibmopay.com/callback
 // CUSTOM https://<YOUR-DOMAIN-CALLBACK-URL> (NOTE: if setting then it Should be notified to the integration/Business team [help@wibmopay.com] )
 pgBundle.putBoolean(SDKConstants.KEY_TEST, false); // for switching test& production
 Intent pgIntent = new Intent(MainActivity.this, PgMerchantOrderActivity.class);
 pgIntent.putExtras(pgBundle);
 startActivityForResult(pgIntent, <YOUR-REQUEST-CODE>);

Checksum creation and usage

The checksum is a field used to validate the parameters of the transaction. To create the checksum we will require the following fields:

  1. Username (your merchant username)
  2. Merchant Transaction ID (merchant_txn_id)
  3. Amount to be requested (amount)
  4. Secret/API Key (your merchant secret)

We create a verifying string in the following manner:

username|merchant_txn_id|amount|secret

Here we are using | (pipe) as a separator. Now we will hash this verifying string with sha512 algorithm and pass it in the calls

Sample Code for Checksum in JAVA

 static String sha1(String input) throws NoSuchAlgorithmException {
        MessageDigest mDigest = MessageDigest.getInstance("SHA-512");
        byte[] result = mDigest.digest(input.getBytes());
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < result.length; i++) {
            sb.append(Integer.toString((result[i] & 0xff) + 0x100, 16).substring(1));
        }
         
        return sb.toString();
    }

For testing of java checksum code please visit URL - http://tpcg.io/kc0v6z

Callback URL

The merchants are required to submit a redirection URL to report the completion of the order. You can share your desired redirection URL with our team on email - admin@wibmopay.com or help@wibmopay.com and we will configure it for you.

The returning checksum is calculated by using username|order_id|merchant_txn_id|status|secret and then creating a hash with sha512 algorithm.

Response

Response Parameters Type Mandatory
"merchant_name" String yes
"order_id" String yes
"merchant_txn_id" String yes
"status" String yes
"payment_mode" String yes
"checksum" String yes
"amount" String yes
"commission" String yes
"channel" String yes

Response parms will be received in the onActivityResult Intent Bundle

onActivityResult(int requestCode, int resultCode, Intent data){}
RESULT CODES Status
RESULT_CANCELED failed
RESULT_OK success

Status Code for RESULT_OK

STATUS CODES Status Description
COMPLETED Success Success
PENDING Same as ABORTED but when no response received (user closes the app/browser)
ABORTED Transactions aborted by users midway (user cancels the transaction)
FAILED for cases where there is an error in creation
RETRIED for cases where the same merchant_txn_id is passed
DECLINED In UPI when the collect request is declined by the user
SETTLED COMPLETED transactions settled to your bank/distribution account in T+2

Status for RESULT_CANCELLED

Status Codes Status Description
MC05 Cancelled By User If txn Cancelled by User or backpressed
MC07 Technical Error Some Request param issue either in validation or not passed. check Studio Logs

Sample Response [java]

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        switch (requestCode) {
        case <your - request - code >:
            if (resultCode == RESULT_CANCELED) {
                Toast.makeText(MainActivity.this, "App: Failed", Toast.LENGTH_SHORT).show();
            } else if (resultCode == RESULT_OK) {
                if (data != null) {
                    Bundle bundle = data.getExtras();
                    String statusCode = bundle.getString("status");
                    //… other values in bundle mentioned in table in Documentation
                }
            }
            break;
        }
    }

Troubleshoot

if you are getting Manifest merger failed issue then please add Please add following line to AndroidManifest.xml

<Application ..
..
..
tools:replace="android:theme,android:label">...</Application>