imepay_merchant_sdk 1.0.0 copy "imepay_merchant_sdk: ^1.0.0" to clipboard
imepay_merchant_sdk: ^1.0.0 copied to clipboard

The IME Pay Payment SDK for flutter gives access to merchants to receive payment from IME Pay customers through their flutter application.

example/lib/main.dart

import 'dart:async';
import 'dart:convert';
import 'dart:math';
import 'package:get/get.dart';
import 'package:flutter/material.dart';
import 'package:imepay_merchant_sdk/constants/app_constants.dart';
import 'package:imepay_merchant_sdk/start_sdk.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'ImePay Merchant SDK',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),


      home: const MyHomePage(title: 'ImePay Merchant SDK'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  // BuildType selectedValue = BuildType.STAGE;
  // BuildType selectedValue = BuildType.LIVE; //Only for production


  //Test and production details to be provided by IME Pay Team

  var MERCHANT_CODE = "TEST_MERCHANTCOD"; // Need to be replace with the Merchant Code provided by IME Pay
  var MERCHANT_NAME = " TEST MERCHANTNAME"; // Need to be replace with the Merchant Name provided by IME Pay
  var MERCHANT_URL = "https://example.com/recordingurl";//Merchant is responsible for preparing the Recording URL. The format of the request/response can be verified in the provided document.
  var AMOUNT = "100";// Amount to be deducted
  var REF_ID = "ABC1234567835"; // Unique Identifier for the transaction. Need to be generated by Merchant and should always be unique
  var MODULE = "TEST_MODULENAME";// Need to be replace with the Module provided by IME Pay
  var USER = "testuser"; //// Need to be replace with the Username provided by IME Pay
  var PASSWORD = "********"; //// Need to be replace with the password provided by IME Pay
  var DELIVERY_URL = "https://www.example.com/deliveryurl";//Merchant is responsible for preparing the delivery url(Webhook). The format of the request/response can be verified in the provided document.
  var BUILD_TYPE = BuildType.STAGE;
  var merchantLogo = "assets/images/merchant_logo.png"; // The Merchant can provide the drawable path, which will be displayed during the transaction.


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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: SingleChildScrollView(
        child: Padding(
          padding: const EdgeInsets.all(10.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.start,
            children: <Widget>[
              InkWell(
                onTap: () async {
                  Random random = new Random();
                  random.nextInt(15);

                  var result = await StartSdk.callSdk(context,
                      merchantCode: MERCHANT_CODE,
                      merchantName: MERCHANT_NAME,
                      merchantUrl: MERCHANT_URL,
                      amount: AMOUNT,
                      refId: REF_ID,
                      module: MODULE,
                      user: USER,
                      password: PASSWORD,
                      deliveryUrl: DELIVERY_URL,
                      buildType: BuildType.STAGE);

                  showDialog(
                    context: context,
                    builder: (BuildContext context) {
                      return AlertDialog(content: Text(json.encode(result)));
                    },
                  );
                  // Navigator.push(context, MaterialPageRoute(builder: (context)=>PhoneNumberScreen()));
                },
                child: Container(
                  padding: EdgeInsets.all(10),
                  color: Colors.red.shade800,
                  child: Text(
                    'Enter',
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 20,
                      fontFamily: AppFont.Volte,
                      fontWeight: FontWeight.w700,
                      package: "imepay_merchant_sdk",
                    ),
                  ),
                ),
              ),
              SizedBox(
                height: 20,
              )
            ],
          ),
        ),
      ),
    );
  }
}
8
likes
0
pub points
71%
popularity

Publisher

verified publisherimepay.com.np

The IME Pay Payment SDK for flutter gives access to merchants to receive payment from IME Pay customers through their flutter application.

Homepage

License

unknown (license)

Dependencies

flutter, get, http

More

Packages that depend on imepay_merchant_sdk