cyberpaysdkflutter 1.0.0+23

  • Readme
  • Changelog
  • Example
  • Installing
  • 59

Cyber Pay Flutter Plugin #

A Flutter package allows you to easily implement the Cyber Pay Credit Card's UI easily with the Card detection.

Codacy Badge

Installing #

  1. Add dependency to pubspec.yaml

    Get the latest version in the 'Installing' tab on pub.dartlang.org

dependencies:
    cyberpaysdkflutter: ^1.0.0+23
  1. Import the package
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:cyberpayflutter_plugin/cyberpayflutter_plugin.dart';


3.1 Adding TransactionObject

With required parameters


    await CyberpayflutterPlugin.makePayment(integrationKey: "INTEGRATION_KEY", customerEmail: "shaba@gmail.com", amount: AMOUNT IN KOBO, liveMode: true );
     

3.2 Call Cyberpay SDK in a Payment Button


 FlatButton(
         onPressed: () async {
           try {
             await CyberpayflutterPlugin.makePayment(integrationKey: "INTEGRATION_KEY", customerEmail: "shaba@gmail.com", amount: 200000, liveMode: true );

           } on PlatformException catch (e) {
             response = "Failed to Invoke: '${e.message}'.";
           }
         },

  1. Get Response Back from InitState

 @override
   void initState() {
     super.initState(); 
     
     platform.setMethodCallHandler((call) {
       final String argument = call.arguments;
       switch (call.method) {
         case "onSuccess":
           
          print("SUCCESS $argument");
 
           break;
       }
       return;

     });
   }

How to use #

Check out the example app in the example directory or the 'Example' tab on pub.dartlang.org for a more complete example.

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

1.0.0+23 #

  • Reduce the sdk version to API 16

1.0.0+22 #

  • Completed the version for flutter SDK with native payment

1.0.0+21 #

  • Initial version, created by Shaba Okare Michael

1.0.0+20 #

Change the url from staging to live

1.0.0+19 #

Bug Fixes, catch success message to SDK

1.0.0+18 #

Bug Fixes, catch success message to SDK

1.0.0+17 #

Bug Fixes, catch error response on Inter Switch transaction Failure

1.0.0+16 #

Bug Fixes, catch error response on Inter Switch transaction Failure

1.0.0+15 #

Bug Fixes, Surround API with try and catch

1.0.0+14 #

Bug Fixes, Revert Equatable in pubspec.yaml

1.0.0+13 #

Bug Fixes, Revert Dio in pubspec.yaml

1.0.0+12 #

Bug Fixes, updated Read ME file

1.0.0+11 #

Bug Fixes

1.0.0+10 #

Bug Fixes and implement other card payments payment - payload

1.0.0+9 #

Bug Fixes and implement other card payments

1.0.0+8 #

Bug Fixes

1.0.0+7 #

Bug Fixes

1.0.0+6 #

Exported the CardModel, TransactionModel and CyberPayAPI

1.0.0+5 #

Exported the Card and OTP model

1.0.0+4 #

  • Maintenance of the project by implementing Formatting to widgets
  • Fix additional 14 files with analysis or formatting issues.

1.0.0+3 #

  • Upgrade of packages to take custom import and export

1.0.0+2 #

  • Bug fixes
  • Upgrade of packages

1.0.0+1 #

  • Initial version, created by Shaba Okare Michael

0.0.1 #

  • TODO: Describe initial release.

example/lib/main.dart

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

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

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

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

class _MyAppState extends State<MyApp> {
  static const platform = const MethodChannel('cyberpayflutter_plugin');

  @override
  void initState() {
    super.initState();
    initCyberPayState();

    platform.setMethodCallHandler((call) {
      final String argument = call.arguments;
      switch (call.method) {
        case "onSuccess":
          print("SUCCESS $argument");
          break;
      }
      return;
    });
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initCyberPayState() async {
    try {
      await CyberpayflutterPlugin.makePayment(
          integrationKey: "d5355204f9cf495f853c8f8d26ada19b",
          customerEmail: "shaba@gmail.com",
          amount: 2000,
          liveMode: false);
    } on PlatformException {}
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Running on: \n'),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  cyberpaysdkflutter: ^1.0.0+23

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:cyberpaysdkflutter/cyberpaysdkflutter.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
31
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
59
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health issues and suggestions

Document public APIs. (-1 points)

9 out of 9 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field https://github.com/cyberspace-ltd/cyberpay_flutter_plugin.git was unreachable.

The description is too long. (-10 points)

Search engines display only the first part of the description. Try to keep the value of the description field in your package's pubspec.yaml file between 60 and 180 characters.

Dependencies

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