flutter_khalti 1.1.0+1 copy "flutter_khalti: ^1.1.0+1" to clipboard
flutter_khalti: ^1.1.0+1 copied to clipboard

discontinuedreplaced by: khalti_flutter
PlatformAndroidiOS

A fluter plugin to process khalti payment

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:flutter_khalti/flutter_khalti.dart';

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

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  _payViaKhalti() async {
    FlutterKhalti _flutterKhalti = FlutterKhalti.configure(
      publicKey: "test_public_key_3a160d15bd484b8c85afd78eb621e49b",
      urlSchemeIOS: "KhaltiPayFlutterExampleScheme",
      paymentPreferences: [
        KhaltiPaymentPreference.KHALTI,
      ],
    );

    KhaltiProduct product = KhaltiProduct(
      id: "test",
      amount: 1000,
      name: "Hello Product",
    );
    _flutterKhalti.startPayment(
      product: product,
      onSuccess: (data) {
        print("here");
      },
      onFaliure: (error) {
        print("sorry");
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: FlatButton(
            child: Text("Pay via khalti"),
            onPressed: _payViaKhalti,
          ),
        ),
      ),
    );
  }
}
11
likes
120
pub points
53%
popularity

Publisher

unverified uploader

A fluter plugin to process khalti payment

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_khalti