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 😎.
To use this package :
dependencies:
flutter:
sdk: flutter
kkiapay_flutter_sdk:
import 'package:kkiapay_flutter_sdk/kkiapayWebview.dart';
final kkiapay = KKiaPay(
@required successCallback: Function(Map<String, dynamic> response, BuildContext context),
@required amount: String,
@required apikey: String,
sandbox: bool,
data: String,
phone: String,
name: String,
theme: dynamic
);
final Widget kkiapayWebview = KkiapayWebview(kkiapay)
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(
successCallback: 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),
);
},
),
),
);
}
}
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 |
theme | String | No | the hexadecimal code of the color you want to give to your widget |
apikey | String | Yes | public api key |
sandbox | Boolean | No | The true value of this attribute allows you to switch to test mode |
successCallback | 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
Please file issues to send feedback or report a bug. Thank you!