molpay_mobile_xdk_flutter_beta 0.18.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new43

molpay_mobile_xdk_flutter_beta

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

  • Minimum Android SDK Version: 25 ++

  • 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
dependencies:
  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:
=========================================

{"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 MOLPay

* 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 MOLPay support should the error persists.
1) Internet not available
2) API credentials (username, password, merchant id, verify key)
3) MOLPay server offline.

Prepare the Payment detail object

var paymentDetails = {
    // Mandatory String. A value more than '1.00'
    'mp_amount': '1.1',
    // Mandatory String. Values obtained from MOLPay
    'mp_username': '',
    'mp_password': '',
    'mp_merchant_ID': '',
    'mp_app_name': '',
    'mp_verification_key': '',

    // Mandatory String. Payment values
    'mp_order_ID': '',
    'mp_currency': 'MYR',
    'mp_country': 'MY',

    // Optional String.
    'mp_channel': '', // 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. 
    'mp_bill_description': 'test payment',
    'mp_bill_name': 'anyname',
    'mp_bill_email': 'example@email.com',
    'mp_bill_mobile': '0161111111',
    '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': '', // Optional for Escrow, put "1" to enable escrow

    // Optional for credit card BIN restrictions
    'mp_bin_lock': ['414170', '414171'], // Optional for credit card BIN restrictions
    'mp_bin_lock_err_msg': 'Only UOB allowed', // Optional for credit card BIN restrictions

    // For transaction request use only, do not use this on payment process
    'mp_transaction_id': '', // Optional, provide a valid cash channel transaction id here will display a payment instruction screen.
    'mp_request_type': '', // Optional, set 'Status' when doing a transactionRequest

    // Optional, use this to customize the UI theme for the payment info screen, the original XDK custom.css file is provided at Example project source for reference and implementation. Required cordova-plugin-file to be installed
    '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, set true to process this transaction through the recurring api, please refer the MOLPay Recurring API pdf  
    'mp_is_recurring': false,

    // Optional for channels restriction 
    'mp_allowed_channels': ['credit', 'credit3'],

    // Optional for sandboxed development environment, set boolean value to enable.
    'mp_sandbox_mode': false,

    // Optional, required a valid mp_channel value, this will skip the payment info page and go direct to the payment screen.
    'mp_express_mode': false,

    // Optional, enable this for extended email format validation based on W3C standards.
    'mp_advanced_email_validation_enabled': true,
    
    // Optional, enable this for extended phone format validation based on Google i18n standards.
    'mp_advanced_phone_validation_enabled' : true,

    // Optional, explicitly force disable billing name edit.
    'mp_bill_name_edit_disabled': false,

    // Optional, explicitly force disable billing email edit.
    'mp_bill_email_edit_disabled': false,

    // Optional, explicitly force disable billing mobile edit.
    'mp_bill_mobile_edit_disabled': false,

    // Optional, explicitly force disable billing description edit.
    'mp_bill_description_edit_disabled': false,

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

    // Optional, enable for online sandbox testing.
    'mp_dev_mode': false
};

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.

Support

Submit issue to this repository or email to our support@molpay.com

Merchant Technical Support / Customer Care : support@molpay.com<br> Sales/Reseller Enquiry : sales@molpay.com<br> Marketing Campaign : marketing@molpay.com<br> Channel/Partner Enquiry : channel@molpay.com<br> Media Contact : media@molpay.com<br> R&D and Tech-related Suggestion : technical@molpay.com<br> Abuse Reporting : abuse@molpay.com

0.18.0

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

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:molpay_mobile_xdk_flutter_beta/molpay_mobile_xdk_flutter_beta.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('MolpayMobileXDK'),
        ),
        body: new Center(
          child: new Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              new RaisedButton(
                child: const Text('Start Molpay'),
                onPressed: () async {
                  
                  var paymentDetails = {
                    // Mandatory String. A value more than '1.00'
                    'mp_amount': '1.1',
                    // Mandatory String. Values obtained from MOLPay
                    'mp_username': '',
                    'mp_password': '',
                    'mp_merchant_ID': '',
                    'mp_app_name': '',
                    'mp_verification_key': '',

                    // Mandatory String. Payment values
                    'mp_order_ID': '',
                    'mp_currency': 'MYR',
                    'mp_country': 'MY',

                    // Optional String.
                    'mp_channel':
                        '', // 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.
                    'mp_bill_description': 'test payment',
                    'mp_bill_name': 'anyname',
                    'mp_bill_email': 'example@email.com',
                    'mp_bill_mobile': '0161111111',
                    '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':
                        '', // Optional for Escrow, put "1" to enable escrow

                    // Optional for credit card BIN restrictions
                    'mp_bin_lock': [
                      '414170',
                      '414171'
                    ], // Optional for credit card BIN restrictions
                    'mp_bin_lock_err_msg':
                        'Only UOB allowed', // Optional for credit card BIN restrictions

                    // For transaction request use only, do not use this on payment process
                    'mp_transaction_id':
                        '', // Optional, provide a valid cash channel transaction id here will display a payment instruction screen.
                    'mp_request_type':
                        '', // Optional, set 'Status' when doing a transactionRequest

                    // Optional, use this to customize the UI theme for the payment info screen, the original XDK custom.css file is provided at Example project source for reference and implementation. Required cordova-plugin-file to be installed
                    '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, set true to process this transaction through the recurring api, please refer the MOLPay Recurring API pdf
                    'mp_is_recurring': false,

                    // Optional for channels restriction
                    'mp_allowed_channels': ['credit', 'credit3'],

                    // Optional for sandboxed development environment, set boolean value to enable.
                    'mp_sandbox_mode': false,

                    // Optional, required a valid mp_channel value, this will skip the payment info page and go direct to the payment screen.
                    'mp_express_mode': false,

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

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

                    // Optional, explicitly force disable billing name edit.
                    'mp_bill_name_edit_disabled': false,

                    // Optional, explicitly force disable billing email edit.
                    'mp_bill_email_edit_disabled': false,

                    // Optional, explicitly force disable billing mobile edit.
                    'mp_bill_mobile_edit_disabled': false,

                    // Optional, explicitly force disable billing description edit.
                    'mp_bill_description_edit_disabled': false,

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

                    // Optional, enable for online sandbox testing.
                    'mp_dev_mode': false
                  };

                  String result = await molpay.startMolpay(paymentDetails);
                  print("Result" + result);
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  molpay_mobile_xdk_flutter_beta: "^0.18.0"

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages 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';
  
Version Uploaded Documentation Archive
0.18.0 May 22, 2018 Go to the documentation of molpay_mobile_xdk_flutter_beta 0.18.0 Download molpay_mobile_xdk_flutter_beta 0.18.0 archive

Analysis

We analyzed this package on Jun 12, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.60.0
  • pana: 0.11.3
  • Flutter: 0.5.2

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
78 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
43
Learn more about scoring.

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 2 hints.

    Run flutter format to format lib/molpay_mobile_xdk_flutter_beta.dart.

Dependencies

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.6 1.14.10
meta 1.1.5
sky_engine 0.0.99
typed_data 1.1.5
vector_math 2.0.6 2.0.7