Last updated:
0 purchases
orange mtn payment
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:
copied to clipboard
Add this line in index.html in Web folder :
<head>
...
<script src="https://cdn.kkiapay.me/k.js"></script>
</head>
copied to clipboard
Usage #
import 'package:kkiapay_flutter_sdk/kkiapay/view/widget_builder_view.dart';
copied to clipboard
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,
reason: String,
email: String,
theme: dynamic,
countries: List<String>,
partnerId: String,
paymentMethods: List<String>
);
copied to clipboard
Create payment webview instance
final Widget kkiapayWebview = KkiapayWebview(kkiapay)
copied to clipboard
Example #
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:kkiapay_flutter_sdk/kkiapay/view/widget_builder_view.dart';
import 'package:kkiapay_flutter_sdk/kkiapayWeb/web_widget_builder.dart';
import 'package:kkiapay_flutter_sdk/utils/kkiapayConf.sample.dart';
void main() => runApp(App());
void successCallback(response, context) {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SuccessScreen(
amount: response['requestData']['amount'],
transactionId: response['transactionId']
)),
);
}
final kkiapay = KKiaPay(
amount: 100,
countries: ["BJ"],
phone: "22961000000",
name: "John Doe",
email: "[email protected]",
reason: 'transaction reason',
data: 'Fake data',
sandbox: true,
apikey: 'XXXXXXXXXXXXXXXXXXXXXX',
callback: successCallback,
theme: defaultTheme, // Ex : "#222F5A",
partnerId: 'AxXxXXxId',
paymentMethods: ["momo","card"]
);
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: () {
if (kIsWeb) {
KKiaPayWeb.pay(kkiapay, (response){
successCallback(response, context);
});
}else{
Navigator.push(
context,
MaterialPageRoute(builder: (context) => kkiapay),
);
}
},
),
),
);
}
}
copied to clipboard
Reference #
ArgumentTypeRequiredDetails
phoneStringYesValid mobile money number to debit. ex : 22967434270
amountNumericYesAmount to debit from user account (XOF)
nameStringNoClient firstname and lastname
partnerIdStringNoYour id to find transaction
countriesList of StringNoSet widget countries ex: ["CI"]
paymentMethodsList of StringNoSet widget payment methods ex: ["momo","card"]
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
successCallbackFunctionYesThis 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
{
'requestData': {
'amount': int,
'phone': String,
'reason': String,
'data': String,
'paymentMethods': List<String>,
'partnerId': String,
'countries': List<String>,
'sandbox': bool,
'name': String,
'email': String
},
'transactionId': String,
'status': String
}
- the context of type BuildContext
copied to clipboard
Issues and feedback #
Please file issues
to send feedback or report a bug. Thank you!
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.