fiuu_mobile_xdk_flutter 3.34.27 copy "fiuu_mobile_xdk_flutter: ^3.34.27" to clipboard
fiuu_mobile_xdk_flutter: ^3.34.27 copied to clipboard

Fiuu Mobile Payment for Flutter

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:fiuu_mobile_xdk_flutter/fiuu_mobile_xdk_flutter.dart';
import 'dart:io' show Platform;
import 'package:intl/intl.dart';

void main() {
  runApp(MyApp());
}

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

class _MyAppState extends State<MyApp> {
  String? _result;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('RMS XDK Example'),
        ),
        body: new Center(
          child: new Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              new ElevatedButton(
                child: const Text('Start XDK'),
                onPressed: () async {
                  DateTime now = DateTime.now();
                  String orderId = DateFormat('yyyyMMddkkmmss').format(now);
                  var paymentDetails = {
                    // TODO: Enter your merchant account credentials before test run
                    "mp_username": "",
                    "mp_password": "",

                    "mp_merchant_ID": "",
                    "mp_app_name": "",
                    "mp_verification_key": '',
                    // TODO: Enter mandatory String
                    "mp_order_ID": orderId, // Unique order id
                    "mp_currency": "MYR",
                    "mp_country": "MY",
                    "mp_amount": "1.01", // Must be in 2 decimal points format
                    "mp_channel": 'multi', // multi = all channels
                    "mp_bill_description": "Testing",
                    "mp_bill_name": "Tester",
                    "mp_bill_email": "test@mail.com",
                    "mp_bill_mobile": "0123456789",

                    // TODO: Learn more about others optional parameters here https://pub.dev/packages/fiuu_mobile_xdk_flutter#prepare-the-payment-detail-object
                    // 'mp_classic_webcore' : true, // Used classic payment webview UI
                    // 'mp_company': 'Your Company Name', // GooglePay merchant name display
                    // "mp_express_mode": true,
                    // "mp_closebutton_display": true,
                    // "mp_enable_fullscreen": true, // Optional : Set true to enable full screen mode
                    // 'mp_extended_vcode': false, // For Google Pay Only - Set true if your account enabled extended Verify Payment
                    // 'mp_silent_error': false,
                    // 'mp_sandbox_mode': false,
                    // 'mp_dev_mode': false,
                    // 'mp_express_mode': false,
                    // 'mp_preferred_token': 'new',
                    // 'mp_ap_merchant_ID': '',
                    // 'mp_advanced_email_validation_enabled': false,
                    // 'mp_advanced_phone_validation_enabled': false,
                    // 'mp_bill_name_edit_disabled': false,
                    // 'mp_bill_email_edit_disabled': false,
                    // 'mp_bill_mobile_edit_disabled': false,
                    // 'mp_bill_description_edit_disabled': false,
                    // 'mp_editing_enabled': false,
                    // 'mp_disabled_channels': ['enetsD'],
                    // 'mp_dpa_id': '',
                    // 'mp_company': '',
                    // 'mp_allowed_channels': ['ApplePay, credit23'],
                    // 'mp_mc2p_key': [],

                    // GPay e-Wallet setting examples :
                    // NOTE: SHOPEEPAY & TNG-EWALLET only applicable to MY & MYR. Others currency & country only supported CC.
                    // 'mp_gpay_channel': ['SHOPEEPAY', 'TNG-EWALLET', 'CC'], // Enable ShopeePay, TNG eWallet & Card
                    // 'mp_gpay_channel': ['SHOPEEPAY', 'TNG-EWALLET'], // Enable ShopeePay & TNG eWallet Only
                    // 'mp_gpay_channel': ['CC', 'TNG-EWALLET'], // Enable Card & TNG eWallet Only
                    // 'mp_hide_googlepay': true, // Hide GooglePay button for Card Payment
                    // 'mp_hide_applepay': true, // Hide ApplePay button for Card Payment
                  };

                  String? result = await MobileXDK.start(paymentDetails);
                  setState(() {
                    _result = result;
                    print("XDK Result = " + result!);
                  });
                },
              ),
              if (Platform.isAndroid)
              // TODO: PayButton API Style & Personalization only applicable to Card payment method. ShopeePay & TNG-eWallet need use others design: https://developers.google.com/pay/api/android/guides/brand-guidelines
                new GestureDetector(
                  onTap: () async {
                    print("logGooglePay googlePay Button Tapped!");
                    DateTime now = DateTime.now();
                    String orderId = DateFormat('yyyyMMddkkmmss').format(now);

                    var paymentDetails = {
                      /*
                     TODO: Follow Google’s instructions to request production access for your app: https://developers.google.com/pay/api/android/guides/test-and-deploy/request-prod-access
                    *
                     Choose the integration type Gateway when prompted, and provide screenshots of your app for review.
                     After your app has been approved, test your integration in production by set mp_sandbox_mode = false & use production mp_verification_key & mp_merchant_ID.
                     Then launching Google Pay from a signed, release build of your app.
                     */
                      'mp_sandbox_mode': true,

                      // TODO : Enter your credentials
                      'mp_merchant_ID': '',
                      'mp_verification_key': '',

                      'mp_order_ID': orderId,
                      'mp_currency': 'MYR',
                      'mp_country': 'MY',

                      'mp_amount': '1.01', // Must be in 2 decimal points format
                      'mp_bill_description': 'Test Google Pay',
                      'mp_bill_name': 'GPay',
                      'mp_bill_email': 'example@gmail.com',
                      'mp_bill_mobile': '123456789',

                      // 'mp_company': 'Your Company Name', // Display merchant name in GooglePay

                      // GPay e-Wallet setting examples :
                      // NOTE: SHOPEEPAY & TNG-EWALLET only applicable to MY & MYR. Others currency & country only supported CC.
                      // 'mp_gpay_channel': ['SHOPEEPAY', 'TNG-EWALLET', 'CC'], // Enable ShopeePay, TNG eWallet & Card
                      // 'mp_gpay_channel': ['SHOPEEPAY', 'TNG-EWALLET'], // Enable ShopeePay & TNG eWallet Only
                      // 'mp_gpay_channel': ['CC', 'TNG-EWALLET'], // Enable Card & TNG eWallet Only

                      // 'mp_extended_vcode': false, // Optional : Set true if your account enabled extended Verify Payment
                      // "mp_closebutton_display": true, // Optional : Enable Close button
                      // "mp_enable_fullscreen": true, // Optional : Set true to enable full screen mode
                    };

                    String? result = await MobileXDK.googlePay(paymentDetails);
                    setState(() {
                      _result = result;
                      print("logGooglePay Result = " + result!);
                    });
                  },
                  child: Image.asset(
                    'assets/gpay.png',
                    width: 99,
                    height: 99,
                  ),
                ),
              if (_result != null)
                Container(
                  margin: const EdgeInsets.all(16.0),
                  padding: const EdgeInsets.all(8.0),
                  decoration: BoxDecoration(
                    border: Border.all(color: Colors.black),
                    borderRadius: BorderRadius.circular(8.0),
                  ),
                  child: Text('Result: $_result'),
                ),
            ],
          ),
        ),
      ),
    );
  }
}
8
likes
140
points
545
downloads

Publisher

verified publisherfiuu.com

Weekly Downloads

Fiuu Mobile Payment for Flutter

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on fiuu_mobile_xdk_flutter

Packages that implement fiuu_mobile_xdk_flutter