flutterkhaltipayment 0.4.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 71

flutterkhaltipayment #

An unofficial Khalti SDK that can be used by Khalti merchants to integrate Khalti payment on their flutter apps.

Supported Platforms

  • Android
  • iOS (Soon)

Usage #

# add this line to your dependencies
dependencies:
  flutterkhaltipayment: ^0.4.0
import 'package:flutterkhaltipayment/flutterkhaltipayment.dart';  
    FlutterKhaltiPayment(
      urlSchemeIOS: "KhaltiPayFlutterExampleScheme",
      merchantKey: "YOUR MERCHANT KEY HERE",
      productId: "0123",
      productName: "Product Name",
      amount: 1000,
      enableEBanking: false,
      enableIPS: false,
      enableMobileBanking: false,
      enableSCT: false,
      productUrl: "http://www.example.com/"
    ).initPayment(
      onSuccess: (data) {
        print("Token Got: ${data["token"].toString()}");
        print("Success got: ${data.toString()}");
      },
      onError: (error) {
        print("error");
        print(error);
      },
    );
propertydescription
merchantKeyString (Not Null)(required)
productIdString (Not Null) (required)
productNameString (Not Null) (required)
amountdouble (Not Null) (required)
enableEBankingboolean (optional)
enableIPSboolean (optional)
enableMobileBankingboolean (optional)
enableSCTboolean (optional)
productUrlString (Nullable) (optional)

If you need any features suggest #

0.1.0 #

  • Initial Release.

0.2.0 #

  • Added Docs

0.3.0 #

  • Fixed bugs occurred during khalti payment success

0.4.0 #

  • Temporarily removed feature to pass custom data while payment cause of issues
  • Added Option to choose Khalti payments Types (EBanking, SCT, Connect-IPS,Mobile Banking)

example/lib/main.dart

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

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

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

class _MyAppState extends State<MyApp> {
   @override
  void initState() {
    super.initState();
  }
  _payViaKhalti() {
    FlutterKhaltiPayment(
      urlSchemeIOS: "KhaltiPayFlutterExampleScheme",
      merchantKey: "YOUR MERCHANT KEY HERE",
      productId: "0123",
      productName: "Product Name",
      amount: 1000,
      enableEBanking: false,
      enableIPS: false,
      enableMobileBanking: false,
      enableSCT: false,
      productUrl: "http://www.example.com/"
    ).initPayment(
      onSuccess: (data) {
        print("Token Got: ${data["token"].toString()}");
        print("Success got: ${data.toString()}");
      },
      onError: (error) {
        print("error");
        print(error);
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: FlatButton(
            color: Colors.purple,
            child: Text("Pay via khalti", style: TextStyle(color: Colors.white),),
            onPressed: () {
              _payViaKhalti();
            },
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutterkhaltipayment: ^0.4.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


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

We analyzed this package on Jul 9, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform ios

Because:

  • package:flutterkhaltipayment/flutterkhaltipayment.dart that declares support for platforms: android

Package does not support Flutter platform linux

Because:

  • package:flutterkhaltipayment/flutterkhaltipayment.dart that declares support for platforms: android

Package does not support Flutter platform macos

Because:

  • package:flutterkhaltipayment/flutterkhaltipayment.dart that declares support for platforms: android

Package does not support Flutter platform web

Because:

  • package:flutterkhaltipayment/flutterkhaltipayment.dart that declares support for platforms: android

Package does not support Flutter platform windows

Because:

  • package:flutterkhaltipayment/flutterkhaltipayment.dart that declares support for platforms: android

Package not compatible with SDK dart

Because:

  • flutterkhaltipayment that is a package requiring null.

Health issues and suggestions

Document public APIs. (-1 points)

4 out of 4 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/flutterkhaltipayment.dart.

Run flutter format to format lib/flutterkhaltipayment.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.1
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety