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

Zest payment sdk for flutter

example/lib/main.dart

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

const PUBLIC_KEY = "";

void main() {
  ZestPay.initialize(publicKey: PUBLIC_KEY);
  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: 'Zest pay example',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  MyHomePage({
    super.key,
  });

  final zestPay = ZestPay();

  _initialTransaction() {
    zestPay
        .initializeTransaction(
            email: "example@gmail.com", currency: "NGN", amount: "3000")
        .then((value) => print(value))
        .catchError((err) => print(err));
  }

  _verifyTransaction() {
    zestPay
        .verifyTransaction(tnxRef: "")
        .then((value) => print(value))
        .catchError((err) => print(err));
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text("Zest pay example"),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'Test everything with clicks',
            ),
            Text(
              'Zest pay your number one payment gateway.',
              style: Theme.of(context).textTheme.headlineMedium,
              textAlign: TextAlign.center,
            ),
            Container(
              child: ElevatedButton(
                onPressed: _initialTransaction,
                child: const Text("Initial transaction"),
              ),
            ),
            Container(
              child: ElevatedButton(
                onPressed: _verifyTransaction,
                child: const Text("Verify transaction"),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
120
points
4
downloads

Publisher

unverified uploader

Weekly Downloads

Zest payment sdk for flutter

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http

More

Packages that depend on zest_pay