kkiapay_flutter_sdk 1.0.4

Flutter Android iOS

KkiaPay allows businesses to safely receive payments by mobile money, credit card and bank account.

kkiapay_flutter_sdk #

Kkiapay is developer friendly solution that allows you to accept mobile money and credit card payments in your application or website.

Before using this SDK, make sure you have a right Merchant Account on Kkiapay, otherwise go and create your account is free and without pain 😎.

Installation #

To use this package :

dependencies:
  flutter:
    sdk: flutter
  kkiapay_flutter_sdk:

Usage #

    import 'package:kkiapay_flutter_sdk/kkiapayWebview.dart';
Initialise the Kkiapay Instance
final kkiapay = KKiaPay(
    @required callback: Function(Map<String, dynamic> response, BuildContext context),
    @required amount: String,
    @required apikey: String,
    sandbox: bool,
    data: String,
    phone: String,
    name: String,
    theme: dynamic
);

Create payment webview instance
final Widget kkiapayWebview = KkiapayWebview(kkiapay)

Example #

import 'package:example/screens/successScreen.dart';
import 'package:flutter/material.dart';
import 'package:kkiapay_flutter_sdk/kkiapayWebview.dart';

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

void successCallback(response, context) {
  Navigator.pop(context);
  Navigator.push(
    context,
    MaterialPageRoute(
        builder: (context) => SuccessScreen( 
              amount: response['amount'],
              transactionId: response['transactionId']
            )),
  );
}

final kkiapay = KKiaPay(
    callback: successCallback,
    amount: '2000',
    sandbox: true,
    data: 'fakedata',
    apikey: 'xxxxxxxxxxxxxxxxxxxxxxx',
    phone: '97000000',
    name: 'JOHN DOE',
    theme: '#2ba359');

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
      appBar: AppBar(
        title: Text('Kkiapay Sample'),
        centerTitle: true,
      ),
      body: KkiapaySample(),
    ));
  }
}

class KkiapaySample extends StatelessWidget {
  const KkiapaySample({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Center(
      child: ButtonTheme(
        minWidth: 250.0,
        height: 60.0,
        child: FlatButton(
          color: Color(0xFFE30E25),
          child: Text(
            'Pay Now',
            style: TextStyle(color: Colors.white),
          ),
          onPressed: () {
            Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => kkiapay),
            );
          },
        ),
      ),
    );
  }
}

Reference #

ArgumentTypeRequiredDetails
phoneStringYesValid mobile money number to debit. ex : 22967434270
amountNumericYesAmount to debit from user account (XOF)
nameStringNoClient firstname and lastname
themeStringNo the hexadecimal code of the color you want to give to your widget
apikeyStringYespublic api key
sandboxBooleanNoThe true value of this attribute allows you to switch to test mode
successCallbackFunctionNoThis function is called once the payment has been successfully made


the successCallback function takes two parameters in the following order
- Map<String,dynamic> containing the transaction information

- the context of type BuildContext


Issues and feedback #

Please file issues to send feedback or report a bug. Thank you!

5
likes
90
pub points
55%
popularity

KkiaPay allows businesses to safely receive payments by mobile money, credit card and bank account.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

latif.boussari@mehriso.com

License

BSD (LICENSE)

Dependencies

cupertino_icons, flutter, flutter_webview_plugin, http, webview_flutter

More

Packages that depend on kkiapay_flutter_sdk