molpay_mobile_xdk_flutter_beta 0.27.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 80

rms_mobile_xdk_flutter_beta #

This is the beta but functional Razer Merchant Services Flutter payment module that is ready to be implemented into any Flutter project. An example application project is provided for Razer Merchant Services XDK framework integration reference.

  • Minimum Android SDK Version: 27 ++

  • Minimum Android API level: 19 ++

  • Minimum Android target version: Android 4.4

  • Minimum Flutter version : 0.2.8 ++

  • Xcode version: 9 ++

  • Minimum target version: iOS 8

Installation #

  1. Add molpay_mobile_xdk_flutter_beta in pubspec.yaml
  molpay_mobile_xdk_flutter_beta: "<put latest release version here>"

  1. flutter packages get

  2. Add the following import to dart code of your application

    import 'package:molpay_mobile_xdk_flutter_beta/molpay_mobile_xdk_flutter_beta.dart';

Add the following keys to Info.plist file for iOS:

  1. 'App Transport Security Settings > Allow Arbitrary Loads > YES'

  2. 'NSPhotoLibraryUsageDescription' > 'Payment images'

  3. 'NSPhotoLibraryAddUsageDescription' > 'Payment images'

Sample Result #

Sample transaction result in JSON string:


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 Razer Merchant Services

* Notes: You may ignore other parameters and values not stated above

* Sample error result in JSON string:

{"Error":"Communication Error"}

Parameter and meaning:

"Communication Error" - Error starting a payment process due to several possible reasons, please contact Razer Merchant Services support should the error persists.
1) Internet not available
2) API credentials (username, password, merchant id, verify key)
3) Razer Merchant Services server offline.

Prepare the Payment detail object #

var paymentDetails = {
    // Optional, REQUIRED when use online Sandbox environment and account credentials.
    'mp_dev_mode': false,

    // Mandatory String. Values obtained from Razer Merchant Services.
    'mp_username' : 'username',
    'mp_password' : 'password',
    'mp_merchant_ID' : 'merchantid',
    'mp_app_name' : 'appname',
    'mp_verification_key' : 'vkey123', 

    // Mandatory String. Payment values.
    'mp_amount' : '1.10',, // Minimum 1.01
    'mp_order_ID' : 'orderid123', 
    'mp_currency' : 'MYR',
    'mp_country' : 'MY',  
    // Optional String.
    'mp_channel' : '', // Use 'multi' for all available channels option. For individual channel seletion, please refer to
    'mp_bill_description' : '',
    'mp_bill_name' : '',
    'mp_bill_email' : '',
    'mp_bill_mobile' : '',
    'mp_channel_editing' : false, // Option to allow channel selection.
    'mp_editing_enabled' : false, // Option to allow billing information editing.

    // Optional, for Escrow.
    'mp_is_escrow': '0', // Put "1" to enable escrow

    // Optional, for credit card BIN restrictions and campaigns.
    'mp_bin_lock' : ['414170', '414171'],   

    // Optional, for mp_bin_lock alert error.
    'mp_bin_lock_err_msg': 'Only UOB allowed',
    // Optional, provide a valid cash channel transaction id here will display a payment instruction screen. Required if mp_request_type is 'Receipt'.
    'mp_transaction_id': '',
    // Optional, use 'Receipt' for Cash channels, and 'Status' for transaction status query.
    '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
    'mp_custom_css_url': '',

    // Optional, set the token id to nominate a preferred token as the default selection, set "new" to allow new card only.
    'mp_preferred_token': '',

    // Optional, credit card transaction type, set "AUTH" to authorize the transaction.
    'mp_tcctype': '',

    // Optional, required valid credit card channel, set true to process this transaction through the recurring api, please refer the Razer Merchant Services Recurring API pdf. 
    'mp_is_recurring': false,

    // Optional, show nominated channels.
    'mp_allowed_channels': ['credit', 'credit3'],

    // Optional, simulate offline payment, set boolean value to enable. 
    '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.
    'mp_express_mode': true,

    // Optional, extended email format validation based on W3C standards.
    'mp_advanced_email_validation_enabled': true,

    // Optional, extended phone format validation based on Google i18n standards.
    'mp_advanced_phone_validation_enabled': true,

    // Optional, explicitly force disable user input.
    'mp_bill_name_edit_disabled': true,
    'mp_bill_email_edit_disabled': true,
    'mp_bill_mobile_edit_disabled': true,
    'mp_bill_description_edit_disabled': true,

    // Optional, EN, MS, VI, TH, FIL, MY, KM, ID, ZH.
    'mp_language': 'EN',

    // Optional, Cash channel payment request expiration duration in hour.
    'mp_cash_waittime': 48,
    // Optional, allow bypass of 3DS on some credit card channels.
    'mp_non_3DS': true,

    // Optional, disable card list option.
    'mp_card_list_disabled': true,

    // Optional for channels restriction, this option has less priority than mp_allowed_channels.
    'mp_disabled_channels': ['credit']  

Start the payment module #

//import molpay package
import 'package:molpay_mobile_xdk_flutter_beta/molpay_mobile_xdk_flutter_beta.dart';

//start molpay payment
String result = await molpay.startMolpay(paymentDetails);
print("Result" + result);

Cash channel payment process (How does it work?) #

This is how the cash channels work on XDK:

1) The user initiate a cash payment, upon completed, the XDK will pause at the “Payment instruction” screen, the results would return a pending status.

2) The user can then click on “Close” to exit the MOLPay XDK aka the payment screen.

3) When later in time, the user would arrive at say 7-Eleven to make the payment, the host app then can call the XDK again to display the “Payment Instruction” again, then it has to pass in all the payment details like it will for the standard payment process, only this time, the host app will have to also pass in an extra value in the payment details, it’s the “mp_transaction_id”, the value has to be the same transaction returned in the results from the XDK earlier during the completion of the transaction. If the transaction id provided is accurate, the XDK will instead show the “Payment Instruction” in place of the standard payment screen.

4) After the user done the paying at the 7-Eleven counter, they can close and exit MOLPay XDK by clicking the “Close” button again.

XDK built-in checksum validator caveats #

All XDK 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 are implementing the private secret key (which the latter is highly recommended and prefereable.) If you would choose to implement the private secret key, you may ignore the "mp_secured_verified" 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)

Support #

Submit issue to this repository or email to our

Merchant Technical Support / Customer Care :
Sales/Reseller Enquiry :
Marketing Campaign :
Channel/Partner Enquiry :
Media Contact :
R&D and Tech-related Suggestion :
Abuse Reporting :

0.18.0 #

  • Initial release
  • Fixed random fails when the billing name contains special characters

0.20.0 #

  • Enhanced the expressmode on external token feature.
  • Added mp_non_3DS parameter.
  • Added mp_card_list_disabled parameter.
  • Added mp_disabled_channels parameter.

0.21.0 #

  • Fixed various bugs at Credit Card input form

0.22.0 #

  • Fixed credit card blank pop up issue when tokenization service not activated

0.22.1 #

  • Added Credit Parameters

0.23.0 #

  • Fixed various special character bugs including `~!@#$%^&*()_-+={[}]|:;"'<,>.?/

0.23.1 #

  • Fixed swift import static_framework

0.23.2 #

  • Fixed return result for ios

0.24.0 #

  • Fixed bugs causing CC number masking toggle not appearing after billing phone edited
  • Reversed CC masking toggle icon
  • Updated to Razer Theme

0.25.0 #

  • [Razer Cash Channel Critical Update] Fixed Cash Receipt screen for CODE128 barcode format and MOLPay brand name removal

0.26.0 #

  • Fixed bugs which caused mp_credit_card_no disappeared when mp_preferred_token is set to new
  • Fixed reversed CVV eye toggle

0.27.0 #

  • Added mp_silent_error private parameter

0.27.1 #

  • Migrate UIWebview to WKWebview


molpay_mobile_xdk_flutter_beta_example #

Demonstrates how to use the molpay_mobile_xdk_flutter_beta plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  molpay_mobile_xdk_flutter_beta: ^0.27.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:molpay_mobile_xdk_flutter_beta/molpay_mobile_xdk_flutter_beta.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Health issues and suggestions

Document public APIs. (-1 points)

4 out of 4 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/molpay_mobile_xdk_flutter_beta.dart. (-0.50 points)

Analysis of lib/molpay_mobile_xdk_flutter_beta.dart reported 1 hint:

line 5 col 7: Name types using UpperCamelCase.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.43.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8