kkiapay_flutter_sdk 0.4.0
kkiapay_flutter_sdk: ^0.4.0 copied to clipboard
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 sucessCallback: Function,
@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';
import 'package:kkiapay_flutter_sdk/utils/Kkiapay.dart';
void main() => runApp(App());
void sucessCallback(response, context) {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SuccessScreen(
amount: response['amount'],
transactionId: response['transactionId']
)),
);
}
final kkiapay = Kkiapay(
sucessCallback: sucessCallback,
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 #
Argument | Type | Required | Details |
phone | String | Yes | Valid mobile money number to debit. ex : 22967434270 |
amount | Numeric | Yes | Amount to debit from user account (XOF) |
name | String | No | Client firstname and lastname |
apikey | String | Yes | public api key |
sandbox | Boolean | No | The true value of this attribute allows you to switch to test mode |
sucessCallback | Function | No | This 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!