Search packages, repositories and app categories

Package detailsv2.0.2

momo_vn

Integrate open MoMo.VN application for payment. Once completed, the system will record data of success or failure. From there handle the next step.

AndroidiOS
30-day downloads
27
Likes
30
Pub points
120

Install package

flutter pub add momo_vn

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The momo_vn package enables integration with the MoMo.VN mobile payment application for Android and iOS, allowing users to complete transactions through the open MoMo app. After a payment is processed, the package records success or failure status, facilitating automated handling of subsequent steps such as order confirmation or error recovery. It simplifies secure in-app payments by leveraging MoMo's established payment infrastructure.

Use cases

  • In-app purchases
  • E-commerce checkout
  • Digital service subscriptions
  • Payment tracking and logging
  • Mobile wallet integration

Key features

  • Seamless MoMo app launch
  • Transaction status recording
  • Success/failure event handling
  • Cross-platform support (Android & iOS)
  • Simple integration via Flutter pub

Suitable for

  • Flutter apps requiring MoMo payments
  • Developers targeting Vietnamese markets
  • Apps with real-time payment validation
  • Businesses using MoMo as primary payment method
  • Projects needing minimal setup for mobile payments

Considerations

  • Requires MoMo app installed on user device
  • Limited to MoMo.VN ecosystem
  • Depends on external app behavior
  • No offline transaction support
  • User must confirm payment within MoMo app

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

momo_vn

Getting Started

  • Need register your application at momo business home page : https://business.momo.vn, detail: https://developers.momo.vn/#/home?id=t%c3%a0i-kho%e1%ba%a3n-doanh-nghi%e1%bb%87p
  • Download testapp, test account at: https://developers.momo.vn/#/docs/testing_information
1. Android set up:
  • Step 1: Request Internet permission at AndroidManifest.xml file:
<uses-permission android:name="android.permission.INTERNET" />
2. iOS set up:
  • Step 1: Update Info.plist file as below:
<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLName</key>
    <string></string>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>partnerSchemeId</string>
    </array>
  </dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
  <string>momo</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>
  • Step 2: Define call back url for momo at AppDelegate.swift file:
import momo_vn
override func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
        MoMoPayment.handleOpenUrl(url: url, sourceApp: sourceApplication!)
        return true
    }

override func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
        MoMoPayment.handleOpenUrl(url: url, sourceApp: "")
        return true
    }
See more setup at: https://developers.momo.vn/#/

Usage

  • Import
import 'package:momo_vn/momo_vn.dart';
  • Init
 void initState() {
    super.initState();
    _momoPay = MomoVn();
    _momoPay.on(MomoVn.EVENT_PAYMENT_SUCCESS, _handlePaymentSuccess);
    _momoPay.on(MomoVn.EVENT_PAYMENT_ERROR, _handlePaymentError);
    initPlatformState();
  }
  • Create data Object
MomoPaymentInfo options = MomoPaymentInfo(
    merchantname: "Tên đối tác",
    merchantcode: 'Mã đối tác',
    appScheme: "1221212",
    amount: 6000000000,
    orderId: '12321312',
    orderLabel: 'Label để hiển thị Mã giao dịch',
    merchantnamelabel: "Tiêu đề tên cửa hàng",
    fee: 0,
    description: 'Mô tả chi tiết',
    username: 'Định danh user (id/email/...)',
    partner: 'merchant',
    extra: "{\"key1\":\"value1\",\"key2\":\"value2\"}",
    isTestMode: true
);
  • Open MoMo application
try {
    _momoPay.open(options);
  } catch (e) {
    debugPrint(e);
  }
  • Get result
void _setState() {
    _payment_status = 'Đã chuyển thanh toán';
    if (_momoPaymentResult.isSuccess) {
      _payment_status += "\nTình trạng: Thành công.";
      _payment_status += "\nSố điện thoại: " + _momoPaymentResult.phonenumber;
      _payment_status += "\nExtra: " + _momoPaymentResult.extra;
      _payment_status += "\nToken: " + _momoPaymentResult.token;
    }
    else {
      _payment_status += "\nTình trạng: Thất bại.";
      _payment_status += "\nExtra: " + _momoPaymentResult.extra;
      _payment_status += "\nMã lỗi: " + _momoPaymentResult.status.toString();
    }
  }
  void _handlePaymentSuccess(PaymentResponse response) {
    setState(() {
      _momoPaymentResult = response;
      _setState();
    });
    Fluttertoast.showToast(msg: "THÀNH CÔNG: " + response.phonenumber, timeInSecForIos: 4);
  }

  void _handlePaymentError(PaymentResponse response) {
    setState(() {
      _momoPaymentResult = response;
      _setState();
    });
    Fluttertoast.showToast(msg: "THẤT BẠI: " + response.message.toString(), timeInSecForIos: 4);
  }

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package