flutterkhaltipayment 0.4.0 copy "flutterkhaltipayment: ^0.4.0" to clipboard
flutterkhaltipayment: ^0.4.0 copied to clipboard

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

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();
            },
          ),
        ),
      ),
    );
  }
}
3
likes
40
pub points
19%
popularity

Publisher

verified publisherbkshah.com.np

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

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on flutterkhaltipayment