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

Fiuu Mobile Payment for Flutter

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:pay/pay.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", // Minimum 1.01 must be in 2 decimal points format
                    "mp_channel": "multi", // multi = all channels
                    "mp_bill_description": "bill description",
                    "mp_bill_name": "bill name",
                    "mp_bill_email": "example@gmail.com",
                    "mp_bill_mobile": "123456789",

                    // TODO: Learn more about others optional parameters here https://pub.dev/packages/fiuu_mobile_xdk_flutter#prepare-the-payment-detail-object
                    // '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': [],
                  };

                  String? result = await MobileXDK.start(paymentDetails);
                  setState(() {
                    _result = result;
                    print("XDK Result = " + result!);
                  });
                },
              ),
              if (Platform.isAndroid)
                // TODO: Choose your preferred Google Pay button : 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.23', // Minimum 1.00 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_extended_vcode': false, // Optional : Set true if your account enabled extended Verify Payment
                    };

                    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'),
                ),
            ],
          ),
        ),
      ),
    );
  }
}
6
likes
130
pub points
74%
popularity

Publisher

unverified uploader

Fiuu Mobile Payment for Flutter

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, pay

More

Packages that depend on fiuu_mobile_xdk_flutter