Installation Guide - Naloff67/Mobile-XDK-RazerMS_Android_Library GitHub Wiki

Welcome to the Mobile-XDK-Fiuu_Android_Java wiki!

How to install !

How to install:

  1. Navigate and locate to Your Project Directory:

    a) Edit the build.gradle (Module: app):

    b) Open the build.gradle file for your app module.

    c) Make any necessary changes or configurations.

    d) Update the settings.gradle:

    e) Locate and update the settings.gradle file.

Remember, these two files are essential for your project setup. Here’s a simplified example:

Sample :

image

  1. In your settings.gradle, add maven { url 'https://jitpack.io' } to dependencyResolutionManagement method.
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Sample :

image

  1. In your build.gradle(Module) add implementation 'com.github.RazerMS:Mobile-XDK-RazerMS_Android_Library:<version> to dependencies method.

replace <version> with the latest XDK version


dependencies {
    implementation 'com.github.RazerMS:Mobile-XDK-RazerMS_Android_Library:<version>'
}

Sample :

image

  1. Sync your project to fetch the new dependencies.

Sample :

image

  1. Add the import com.molpay.molpayxdk.MOLPayActivity; to your MainActivity.java
import com.molpay.molpayxdk.MOLPayActivity;

Sample :

image

Prepare the Payment detail object

To Use rms-mobile-xdk-android_studio, you will need the method below.

Note : text with <> you will need to remove and place your String.

private void PaymentDetails() {
HashMap<String, Object> paymentDetails = new HashMap<>();

    // Optional, REQUIRED when use online Sandbox environment and account credentials.
    paymentDetails.put(MOLPayActivity.mp_dev_mode, false);

    // Mandatory String. Values obtained from MOLPay.
    paymentDetails.put(MOLPayActivity.mp_username, "<username>");
    paymentDetails.put(MOLPayActivity.mp_password, "<password>");
    paymentDetails.put(MOLPayActivity.mp_merchant_ID, "<merchantid>");
    paymentDetails.put(MOLPayActivity.mp_app_name, "<appname>");
    paymentDetails.put(MOLPayActivity.mp_verification_key, "<vkey123>");

    // Mandatory String. Payment values.
    paymentDetails.put(MOLPayActivity.mp_amount, "<1.10>"); // Minimum 1.01
    paymentDetails.put(MOLPayActivity.mp_order_ID, "<orderid123>");
    paymentDetails.put(MOLPayActivity.mp_currency, "<MYR>");
    paymentDetails.put(MOLPayActivity.mp_country, "<MY>");
}

Below are the optional fields, depending on your business preference you may add to the var paymentDetails object for you to use.

  
    // Optional, but required payment values. User input will be required when values not passed.
    // Use 'multi' for all available channels option. For individual channel     seletion, please refer to https://github.com/MOLPay/molpay-mobile-xdk-examples/blob/master/channel_list.tsv.
    paymentDetails.put(MOLPayActivity.mp_channel, "multi");
    paymentDetails.put(MOLPayActivity.mp_bill_description, "billdesc");
    paymentDetails.put(MOLPayActivity.mp_bill_name, "billname");
    paymentDetails.put(MOLPayActivity.mp_bill_email, "[email protected]");
    paymentDetails.put(MOLPayActivity.mp_bill_mobile, "+1234567");

    // Optional, allow channel selection. 
    paymentDetails.put(MOLPayActivity.mp_channel_editing, false);

    // Optional, allow billing information editing.
    paymentDetails.put(MOLPayActivity.mp_editing_enabled, false);

    // Optional, for Escrow.
    paymentDetails.put(MOLPayActivity.mp_is_escrow, ""); // Put "1" to enable escrow

    // Optional, for credit card BIN restrictions and campaigns.
    String binlock[] = {"414170","414171"};
    paymentDetails.put(MOLPayActivity.mp_bin_lock, binlock);

    // Optional, for mp_bin_lock alert error.
    paymentDetails.put(MOLPayActivity.mp_bin_lock_err_msg, "Only UOB allowed");
    
    // WARNING! FOR TRANSACTION QUERY USE ONLY, DO NOT USE THIS ON PAYMENT PROCESS.
    // Optional, provide a valid cash channel transaction id here will display a payment instruction screen. Required if mp_request_type is 'Receipt'.
    paymentDetails.put(MOLPayActivity.mp_transaction_id, "");
    // Optional, use 'Receipt' for Cash channels, and 'Status' for transaction status query.
    paymentDetails.put(MOLPayActivity.mp_request_type, "");

    // Optional, use this to customize the UI theme for the payment info screen, the original XDK custom.css file can be obtained at https://github.com/MOLPay/molpay-mobile-xdk-examples/blob/master/custom.css.
    paymentDetails.put(MOLPayActivity.mp_custom_css_url, "file:///android_asset/custom.css");

    // Optional, set the token id to nominate a preferred token as the default selection, set "new" to allow new card only.
    paymentDetails.put(MOLPayActivity.mp_preferred_token, "");

    // Optional, credit card transaction type, set "AUTH" to authorize the transaction.
    paymentDetails.put(MOLPayActivity.mp_tcctype, "");

    // Optional, required valid credit card channel, set true to process this transaction through the recurring api, please refer the MOLPay Recurring API pdf. 
    paymentDetails.put(MOLPayActivity.mp_is_recurring, false);

    // Optional, show nominated channels.
    String allowedchannels[] = {"credit","credit3"};
    paymentDetails.put(MOLPayActivity.mp_allowed_channels, allowedchannels);

    // Optional, simulate offline payment, set boolean value to enable. 
    paymentDetails.put(MOLPayActivity.mp_sandbox_mode, true);

    // Optional, required a valid mp_channel value, this will skip the payment info page and go direct to the payment screen.
    paymentDetails.put(MOLPayActivity.mp_express_mode, true);

    // Optional, extended email format validation based on W3C standards.
    paymentDetails.put(MOLPayActivity.mp_advanced_email_validation_enabled, true);

    // Optional, extended phone format validation based on Google i18n standards.
    paymentDetails.put(MOLPayActivity.mp_advanced_phone_validation_enabled, true);

    // Optional, explicitly force disable user input.
    paymentDetails.put(MOLPayActivity.mp_bill_name_edit_disabled, true);
    paymentDetails.put(MOLPayActivity.mp_bill_email_edit_disabled, true);
    paymentDetails.put(MOLPayActivity.mp_bill_mobile_edit_disabled, true);
    paymentDetails.put(MOLPayActivity.mp_bill_description_edit_disabled, true);

    // Optional, EN, MS, VI, TH, FIL, MY, KM, ID, ZH.
    paymentDetails.put(MOLPayActivity.mp_language, "EN");

    // Optional, Cash channel payment request expiration duration in hour.
    paymentDetails.put(MOLPayActivity.mp_cash_waittime, 48);
    
    // Optional, allow bypass of 3DS on some credit card channels.
    paymentDetails.put(MOLPayActivity.mp_non_3DS, true);

    // Optional, disable card list option.
    paymentDetails.put(MOLPayActivity.mp_card_list_disabled, true);

    // Optional for channels restriction, this option has less priority than mp_allowed_channels.
    String disabledChannels[] = {"credit"};
    paymentDetails.put(MOLPayActivity.mp_disabled_channels, disabledChannels);

For more descriptive explanation on each parameter fields, you can view the provided file below :

XDK parameters reference

Start the payment module

    Intent intent = new Intent(MainActivity.this, MOLPayActivity.class);
     intent.putExtra(MOLPayActivity.MOLPayPaymentDetails, paymentDetails);
       startActivityForResult(intent, MOLPayActivity.MOLPayXDK);


Callback Function

Add the result callback function to get return results when the payment activity ended

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
    if (requestCode == MOLPayActivity.MOLPayXDK && resultCode == RESULT_OK){
        Log.d(MOLPayActivity.MOLPAY, "MOLPay result = "+data.getStringExtra(MOLPayActivity.MOLPayTransactionResult));
    }
}

XDK built-in checksum validator caveats

All XDKs come with a built-in checksum validator to validate all incoming checksums and return the validation result through the mp_secured_verified parameter. However, this mechanism will fail and always return false if merchants implement the private secret key (which is highly recommended and preferable). If you choose to implement the private secret key, you may ignore the mp_secured_verified parameter and send the checksum back to your server for validation.

Private Secret Key checksum validation formula

chksum = MD5(mp_merchant_ID + results.msgType + results.txn_ID + results.amount + results.status_code + merchant_private_secret_key)

Sample Result

Sample Transaction result in JSON String :


{"status_code":"11","amount":"1.01","chksum":"34a9ec11a5b79f31a15176ffbcac76cd","pInstruction":0,"msgType":"C6","paydate":1459240430,"order_id":"3q3rux7dj","err_desc":"","channel":"Credit","app_code":"439187","txn_ID":"6936766"}

Parameter and meaning

  • "status_code" - "00" for Success, "11" for Failed, "22" for *Pending.(*Pending status only applicable to cash channels only)
  • "amount" - The transaction amount
  • "paydate" - The transaction date
  • "order_id" - The transaction order id
  • "channel" - The transaction channel description
  • "txn_ID" - The transaction id generated by Fiuu

Note : You can ignore other parameters and values not stated above and it will still show results.

Sample Transaction result in JSON String :

{"Error":"Communication Error"}

Parameter and meaning:

  • "Communication Error" - Error starting a payment process due to several possible reasons, please contact Fiuu support should the error persists.

Possible reasons

  • Internet not available
  • API credentials (username, password, merchant id, verify key)
  • Fiuu server offline.

The End

That's it! You've successfully added the Mobile-XDK-RazerMS_Android_Java package to your Java project and can now leverage its features within your application !

Note : If you ever get lost you can use the example project provided in this git so you can follow along.

⚠️ **GitHub.com Fallback** ⚠️