paystack_flutter 0.0.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new50

Paystack Flutter Plugin

A Paystack Plugin for flutter developers for receiving payments online(Android currently supported, still working on the ios).

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

Screenshots

<img src="sc1.png" height="300em" /> <img src="sc2.png" height="300em" /> <img src="sc3.png" height="300em" /> <img src="sc4.png" height="300em" /> <img src="sc5.png" height="300em" /> <img src="sc6.png" height="300em" /> <img src="sc7.png" height="300em" />

Usage

To use this package :

  dependencies:
    flutter:
      sdk: flutter
    paystack_flutter:

## Connecting to Paystack
First, you should create define your paystack variables `PAYSTACK_PUBLIC_KEY`  and `BACKEND_URL` like this :
   
   

static const paystack_pub_key = "Your_Paystack_Public_Key"; static const paystack_backend_url = "https://infinite-peak-60063.herokuapp.com";



After the variables have been defined create a new function or method `connectPaystack` which is used to initialize flutter channel :

connectPaystack() async { String result; try { result = await PaystackFlutter.connectToPaystack({ "NAME": "Your Name", "EMAIL": "you@email.com", "AMOUNT": 100, "CURRENCY": "NGN", "PAYMENT_FOR": "Testing API", "PAYSTACK_PUBLIC_KEY":paystack_pub_key, "BACKEND_URL": paystack_backend_url, }); } on PlatformException catch (e) { result = e.message; print(e.message); }

 if (!mounted) return;

 setState(() {
   transcation = result;
 });

}




## Paystack Channel Response codes

Listen for response via the result, with the response you can do as use please

} on PlatformException catch (e) { result = e.message; print(e.message); }



For Successful transaction result is `SUCCESSFULL`
For Failed transaction result is `UNSUCCESSFULL`


## Complete Code Setup example

import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:paystack_flutter/paystack_flutter.dart';

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

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

class _MyAppState extends State<MyApp> { String transcation = 'No transcation Yet'; Map<String, dynamic> _data = {};

static const platform = const MethodChannel('maugost.com/paystack_flutter'); static const paystack_pub_key = "Your_Paystack_Public_Key"; static const paystack_backend_url = "https://infinite-peak-60063.herokuapp.com";

@override initState() { super.initState(); }

@override Widget build(BuildContext context) { return new MaterialApp( home: new Scaffold( appBar: new AppBar( title: new Text('Flutter Paystack '), ), body: new Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ new Text(transcation), new Padding( padding: const EdgeInsets.all(10.0), child: new RaisedButton( child: new Text("Pay with Paystack N100"), onPressed: connectPaystack, ), ), ], ), ), ), ); }

connectPaystack() async { String result; try { result = await PaystackFlutter.connectToPaystack({ "NAME": "Your Name", "EMAIL": "you@email.com", "AMOUNT": 100, "CURRENCY": "NGN", "PAYMENT_FOR": "Testing API", "PAYSTACK_PUBLIC_KEY": paystack_pub_key, "BACKEND_URL": paystack_backend_url, }); } on PlatformException catch (e) { result = e.message; print(e.message); }

if (!mounted) return;

setState(() {
  transcation = result;
});

} }


[0.0.1] - Release 5/16/18

  • A Paystack Plugin for Flutter Developers to receiving payments in their flutter apps. currently android supported(Still working on the ios), written in dart.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:paystack_flutter/paystack_flutter.dart';

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

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

class _MyAppState extends State<MyApp> {
  String transcation = 'No transcation Yet';
  Map<String, dynamic> _data = {};

  static const platform = const MethodChannel('maugost.com/paystack_flutter');
  static const paystack_pub_key = "Your_paystack_public_key";
  static const paystack_backend_url =
      "https://infinite-peak-60063.herokuapp.com";

  @override
  initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Flutter Paystack '),
        ),
        body: new Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              new Text(transcation),
              new Padding(
                padding: const EdgeInsets.all(10.0),
                child: new RaisedButton(
                  child: new Text("Pay with Paystack N100"),
                  onPressed: connectPaystack,
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }

  connectPaystack() async {
    String result;
    try {
      result = await PaystackFlutter.connectToPaystack({
        "NAME": "Your Name",
        "EMAIL": "you@email.com",
        "AMOUNT": 100,
        "CURRENCY": "NGN",
        "PAYMENT_FOR": "Testing API",
        "PAYSTACK_PUBLIC_KEY": paystack_pub_key,
        "BACKEND_URL": paystack_backend_url,
      });
    } on PlatformException catch (e) {
      result = e.message;
      print(e.message);
    }

    if (!mounted) return;

    setState(() {
      transcation = result;
    });
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  paystack_flutter: "^0.0.2"

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


      import 'package:paystack_flutter/paystack_flutter.dart';
  
Version Uploaded Documentation Archive
0.0.2 May 17, 2018 Go to the documentation of paystack_flutter 0.0.2 Download paystack_flutter 0.0.2 archive
0.0.1 May 16, 2018 Go to the documentation of paystack_flutter 0.0.1 Download paystack_flutter 0.0.1 archive

Analysis

We analyzed this package on May 17, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.54.0
  • pana: 0.10.6
  • Flutter: 0.4.4

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
50
Learn more about scoring.

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.6 1.14.9
meta 1.1.5
sky_engine 0.0.99
typed_data 1.1.5
vector_math 2.0.6 2.0.7