cyberpayflutter 1.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 63

Cyberpay #

pub package

Introduction #

Cyberpay provides you with the most convenient and fastest process of making and collecting payments from your customers within Nigeria

About the SDK #

The mobile SDK will serve as an easy to use library to quickly integrate Cyberpay to your mobile application.

The will serve as a wrapper on the existing Cyberpay web services and create a mobile entry point for making both Card and Bank transactions.

The SDK will provide custom views/layouts for checkout, pin, otp, sucured3d as well as handles all business logics taking the bulk of the job and exposing just three call backs representing the status of the transaction.

Requirements #

The Cyberpay Flutter SDK is compatible with iOS Apps supporting iOS 11 and above.

Getting Started #

Installing #

  1. Add the cyberpay package to the dependencies section of your pubspec.yaml file. The code below makes the Dart API of the cyberpayflutter plugin available in your application

    dependencies:
     cyberpayflutter: ^1.0.2
    
  2. Run the following command in your terminal after navigating to your project directory, to download the package

     flutter pub get
    

Using the Cyberpay SDK #

Step 1: Import the cyberpay sdk

    import 'package:cyberpayflutter/cyberpayflutter.dart';

Step 2: Complete integration with Our Drop-In UI

    try {
      var result = await Cyberpayflutter.makePayment(
          integrationKey: "MERCHANT_INTEGRATION_KEY",
          amount: "PAYMENT_AMOUNT_IN_KOBO",
          customerEmail: "CUSTOMER_EMAIL",
          liveMode: false);
        if (result.isPaymentSuccessFul) {
        print("Payment is Successfult, Your Payment Reference: ${result.paymentReference}");
        } 
        else {
            print(result.errorMessage);
      }
    } on PlatformException catch (e) {
        var error = "Cyberpay Error: '${e.message}'.";
        print(error);
    }

Cyberpay Intergration, when Transaction has been set in the server) #

Step 1: Import the cyberpay sdk

    import 'package:cyberpayflutter/cyberpayflutter.dart';

Step 2: Complete integration with Our Server Drop-In UI

    try {
      var result = await Cyberpayflutter.makePaymentWithReference(
          integrationKey: "MERCHANT_INTEGRATION_KEY",
          reference: "TRANSACTION_REFERENCE_FROM_SERVER",
          liveMode: false);
      if (result.isPaymentSuccessFul) {
        print(
            "Payment is Successfult, Your Payment Reference: ${result.paymentReference}");
      } else {
        print(result.errorMessage);
      }
    } on PlatformException catch (e) {
      var error = "Cyberpay Error: '${e.message}'.";
      print(error);
    }

Note : Ensure when going live, you change liveMode to true, and also change the integration key. This key can be gotten from the merchant dashboard on the cyberpay merchant portal

Example #

To run the example project, clone the repo, and run the following command in your terminal:

flutter run

License #

cyberpaysdk is available under the MIT license. See the LICENSE file for more info.

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[0.0.1] - 2020-05-16 #

Added #

  • New visual identity by @David Ehigiator.
  • Includes payment using bank account
  • Includes payment using Cards (Verve, Mastercard, Visa)

[1.0.0] - 2020-05-16 #

Added #

[1.0.1] - 2020-05-16 #

Added #

  • Minor documentation fixes

[1.0.2] - 2020-05-16 #

Added #

  • Updated Cyberpay SDK dependencies to remove all instance of the depreciated UIWebView

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:cyberpayflutter/cyberpayflutter.dart';

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

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

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


  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> makePaymentWithReference() async {
    try {
      var result = await Cyberpayflutter.makePaymentWithReference(
          integrationKey: "MERCHANT_INTEGRATION_KEY",
          reference: "REFERENCE_GOTTEN_FROM_SERVER",
          liveMode: false);
      if (result.isPaymentSuccessFul) {
        print(
            "Payment is Successfult, Your Payment Reference: ${result.paymentReference}");
      } else {
        print(result.errorMessage);
      }
    } on PlatformException catch (e) {
      var error = "Cyberpay Error: '${e.message}'.";
      print(error);
    }
  }

  Future<void> makeSamplePayment() async {
    try {
      var result = await Cyberpayflutter.makePayment(
          integrationKey: "MERCHANT_INTEGRATION_KEY",
          amount: 10000,
          customerEmail: "CUSTOMER_EMAIL",
          liveMode: false);
      if (result.isPaymentSuccessFul) {
        print(
            "Payment is Successfult, Your Payment Reference: ${result.paymentReference}");
      } else {
        print(result.errorMessage);
      }
    } on PlatformException catch (e) {
      var error = "Cyberpay Error: '${e.message}'.";
      print(error);
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          title: const Text('A demo Cyberpay Flutter Payment'),
        ),
        body: Center(
            child: MaterialButton(
          child: Text('Pay Demo N100'),
          elevation: 8,
          color: Colors.redAccent,
          colorBrightness: Brightness.dark,
          highlightElevation: 2,
          padding: EdgeInsets.all(20.0),
          onPressed: () {
            makeSamplePayment();
          },
        )),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  cyberpayflutter: ^1.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


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

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:cyberpayflutter/cyberpayflutter.dart] that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because of import path [package:cyberpayflutter/cyberpayflutter.dart] that declares support for platforms: android, ios

Package does not support Flutter platform web

Because of import path [package:cyberpayflutter/cyberpayflutter.dart] that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because of import path [package:cyberpayflutter/cyberpayflutter.dart] that declares support for platforms: android, ios

Package not compatible with SDK dart

because of import path [cyberpayflutter] that is in a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test