digital_pay 1.0.3 copy "digital_pay: ^1.0.3" to clipboard
digital_pay: ^1.0.3 copied to clipboard

This package allows you to make your payments safely. Designed to make your task easier with a simple widget.

example/lib/main.dart

import 'dart:io';

import 'package:digital_pay/digital_pay.dart';
import 'package:digital_pay/required.dart';
import 'package:flutter/material.dart';

//Secure all hhtp request with [https]
class MyHttpOverrides extends HttpOverrides {
  @override
  HttpClient createHttpClient(context) {
    return super.createHttpClient(context)
      ..badCertificateCallback =
          (X509Certificate cert, String host, int port) => true;
  }
}
//END secure http

//Change your main App
void main() async {
  //intialize http requests
  HttpOverrides.global = MyHttpOverrides();
  return runApp(const MyApp());
}
//END Change

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'DIGITAL PAY',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("DIGITAL PAY"),
        centerTitle: true,
        backgroundColor: Colors.orange,
      ),
      body: Center(
        child: TextButton(
            style: ButtonStyle(
                backgroundColor: MaterialStateProperty.all(Colors.orange),
                padding: MaterialStateProperty.all(
                    const EdgeInsets.symmetric(horizontal: 50))),
            onPressed: () {
              DigitalPay.checkout(
                      context: context,
                      accessToken: "MY_ACCESS_TOKEN",
                      amount: 10000,
                      color: Colors.red)
                  .then((result) {
                // ignore: avoid_print
                (result);
                toastMsg(result["message"]);
              });
            },
            child: const Text(
              "Payer",
              style: TextStyle(color: Colors.white),
            )),
      ),
    );
  }
}
2
likes
130
pub points
0%
popularity

Publisher

unverified uploader

This package allows you to make your payments safely. Designed to make your task easier with a simple widget.

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (LICENSE)

Dependencies

country_picker, currency_formatter, flutter, flutter_inappwebview, flutter_spinkit, fluttertoast, html, http, http_parser, mask_text_input_formatter, url_launcher, wc_form_validators

More

Packages that depend on digital_pay