techpay 0.0.3 copy "techpay: ^0.0.3" to clipboard
techpay: ^0.0.3 copied to clipboard

Receive mobile money and card payments using the techpay payment gateway.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo App'),
    );
  }
}

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

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

class _MyHomePageState extends State<MyHomePage> {
  String res = '';
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        centerTitle: true,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'Your bill is k1.89\nProceed with payment',),
            SizedBox(
              width: 250,
              height: 85,
              child: Techpay(
                  apiKey: 'your apiKey',
                  appId: 'your appId', amount: 1.98, reference: 'bills_payment',
                  orderNumber: '0202300',
                  onPaymentResponse: (response) {
                    print(response);
                    // the response (json) parameter contains the payment response from techpay
                    // display the response message
                    ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(response['message'])));
                    // Continue the application process flow
                  }
              ),
            ),
          ],
        ),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
1
likes
140
points
40
downloads

Publisher

verified publishertechpay.co.zm

Weekly Downloads

Receive mobile money and card payments using the techpay payment gateway.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http, webview_flutter

More

Packages that depend on techpay