-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
163 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"url_launcher_ios","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_ios-6.1.5/","native_build":true,"dependencies":[]},{"name":"webview_flutter_wkwebview","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.9.1/","native_build":true,"dependencies":[]}],"android":[{"name":"url_launcher_android","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_android-6.1.0/","native_build":true,"dependencies":[]},{"name":"webview_flutter_android","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/webview_flutter_android-3.12.0/","native_build":true,"dependencies":[]}],"macos":[{"name":"url_launcher_macos","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_macos-3.0.7/","native_build":true,"dependencies":[]}],"linux":[{"name":"url_launcher_linux","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_linux-3.0.6/","native_build":true,"dependencies":[]}],"windows":[{"name":"url_launcher_windows","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_windows-3.0.8/","native_build":true,"dependencies":[]}],"web":[{"name":"url_launcher_web","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_web-2.0.20/","dependencies":[]}]},"dependencyGraph":[{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]},{"name":"webview_flutter","dependencies":["webview_flutter_android","webview_flutter_wkwebview"]},{"name":"webview_flutter_android","dependencies":[]},{"name":"webview_flutter_wkwebview","dependencies":[]}],"date_created":"2023-10-23 10:15:16.891876","version":"3.13.7"} | ||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"url_launcher_ios","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_ios-6.2.0/","native_build":true,"dependencies":[]},{"name":"webview_flutter_wkwebview","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.9.2/","native_build":true,"dependencies":[]}],"android":[{"name":"url_launcher_android","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_android-6.2.0/","native_build":true,"dependencies":[]},{"name":"webview_flutter_android","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/webview_flutter_android-3.12.0/","native_build":true,"dependencies":[]}],"macos":[{"name":"url_launcher_macos","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_macos-3.1.0/","native_build":true,"dependencies":[]}],"linux":[{"name":"url_launcher_linux","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_linux-3.1.0/","native_build":true,"dependencies":[]}],"windows":[{"name":"url_launcher_windows","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.0/","native_build":true,"dependencies":[]}],"web":[{"name":"url_launcher_web","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_web-2.2.0/","dependencies":[]}]},"dependencyGraph":[{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]},{"name":"webview_flutter","dependencies":["webview_flutter_android","webview_flutter_wkwebview"]},{"name":"webview_flutter_android","dependencies":[]},{"name":"webview_flutter_wkwebview","dependencies":[]}],"date_created":"2023-11-02 10:31:19.134667","version":"3.13.7"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,18 +28,18 @@ dependencies: | |
```dart | ||
final kkiapay = KKiaPay( | ||
@required callback: Function(Map<String, dynamic> response, BuildContext context), | ||
@required amount: String, | ||
@required apikey: String, | ||
@required sandbox: bool, | ||
data: String, | ||
phone: String, | ||
name: String, | ||
reason: String, | ||
email: String, | ||
theme: dynamic, | ||
countries: List<String>, | ||
partnerId: String, | ||
paymentMethods: List<String> | ||
@required amount: int, // Ex : 1000 | ||
@required apikey: String, // Ex : XXXX_public_api_key_XXX | ||
@required sandbox: bool, // Ex : true | ||
data: String, // Ex : 'Big data' | ||
phone: String, // Ex : "22961000000" | ||
name: String, // Ex : "John Doe" | ||
reason: String, // Ex : "transaction reason" | ||
email: String, // Ex : "[email protected]" | ||
theme: String, // Ex : "#222F5A" | ||
countries: List<String>, // Ex : ["CI"] | ||
partnerId: String, // Ex : 'AxXxXXxId' | ||
paymentMethods: List<String> // Ex : ["momo","card"] | ||
); | ||
``` | ||
|
@@ -53,91 +53,108 @@ Navigator.push(context, MaterialPageRoute(builder: (context) => kkiapay), | |
## Example | ||
|
||
```dart | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:kkiapay_flutter_sdk/kkiapay/src/widget_builder_view.dart'; | ||
import 'package:kkiapay_flutter_sdk/kkiapayWeb/web_widget_builder.dart'; | ||
import 'package:kkiapay_flutter_sdk/src/widget_builder_view.dart'; | ||
import 'package:kkiapay_flutter_sdk/utils/config.dart'; | ||
import './successScreen.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'] | ||
)), | ||
); | ||
switch ( response['status'] ) { | ||
case PAYMENT_CANCELLED: print(PAYMENT_CANCELLED); | ||
break; | ||
case PAYMENT_SUCCESS: | ||
Navigator.push( | ||
context, | ||
MaterialPageRoute( | ||
builder: (context) => SuccessScreen( | ||
amount: response['requestData']['amount'], | ||
transactionId: response['transactionId'], | ||
), | ||
), | ||
); | ||
break; | ||
case PAYMENT_FAILED: print(PAYMENT_FAILED); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
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, | ||
amount: 1000,// | ||
countries: ["BJ"],// | ||
phone: "22961000000",// | ||
name: "John Doe",// | ||
email: "[email protected]",// | ||
reason: 'transaction reason',// | ||
data: 'Fake data',// | ||
sandbox: true,// | ||
apikey: public_api_key,// | ||
callback: successCallback,// | ||
theme: defaultTheme, // Ex : "#222F5A", | ||
partnerId: 'AxXxXXxId', | ||
paymentMethods: ["momo","card"] | ||
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, | ||
debugShowCheckedModeBanner: false, | ||
home: Scaffold( | ||
appBar: AppBar( | ||
backgroundColor: nColorPrimary, | ||
title: Text('Kkiapay Sample'), | ||
centerTitle: true, | ||
), | ||
body: KkiapaySample(), | ||
), | ||
body: KkiapaySample(), | ||
)); | ||
); | ||
} | ||
} | ||
class KkiapaySample extends StatelessWidget { | ||
const KkiapaySample({ | ||
Key key, | ||
Key? key, | ||
}) : super(key: key); | ||
@override | ||
Widget build(BuildContext context) { | ||
return Center( | ||
child: | ||
ButtonTheme( | ||
minWidth: 500.0, | ||
height: 100.0, | ||
child: TextButton( | ||
style: ButtonStyle( | ||
backgroundColor: MaterialStateProperty.all(Color(0xff222F5A)), | ||
foregroundColor: MaterialStateProperty.all(Colors.white), | ||
), | ||
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), | ||
); | ||
} | ||
}, | ||
), | ||
), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.center, | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
ButtonTheme( | ||
minWidth: 500.0, | ||
height: 100.0, | ||
child: TextButton( | ||
style: ButtonStyle( | ||
backgroundColor: MaterialStateProperty.all(Color(0xff222F5A)), | ||
foregroundColor: MaterialStateProperty.all(Colors.white), | ||
), | ||
child: const Text( | ||
'Pay Now', | ||
style: TextStyle(color: Colors.white), | ||
), | ||
onPressed: () { | ||
Navigator.push( | ||
context, | ||
MaterialPageRoute(builder: (context) => kkiapay), | ||
); | ||
}, | ||
), | ||
) | ||
], | ||
) | ||
); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"url_launcher_ios","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_ios-6.1.5/","native_build":true,"dependencies":[]},{"name":"webview_flutter_wkwebview","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.9.1/","native_build":true,"dependencies":[]}],"android":[{"name":"url_launcher_android","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_android-6.1.0/","native_build":true,"dependencies":[]},{"name":"webview_flutter_android","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/webview_flutter_android-3.12.0/","native_build":true,"dependencies":[]}],"macos":[{"name":"url_launcher_macos","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_macos-3.0.7/","native_build":true,"dependencies":[]}],"linux":[{"name":"url_launcher_linux","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_linux-3.0.6/","native_build":true,"dependencies":[]}],"windows":[{"name":"url_launcher_windows","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_windows-3.0.8/","native_build":true,"dependencies":[]}],"web":[{"name":"url_launcher_web","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_web-2.0.20/","dependencies":[]}]},"dependencyGraph":[{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]},{"name":"webview_flutter","dependencies":["webview_flutter_android","webview_flutter_wkwebview"]},{"name":"webview_flutter_android","dependencies":[]},{"name":"webview_flutter_wkwebview","dependencies":[]}],"date_created":"2023-10-23 10:15:16.934505","version":"3.13.7"} | ||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"url_launcher_ios","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_ios-6.2.0/","native_build":true,"dependencies":[]},{"name":"webview_flutter_wkwebview","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.9.2/","native_build":true,"dependencies":[]}],"android":[{"name":"url_launcher_android","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_android-6.2.0/","native_build":true,"dependencies":[]},{"name":"webview_flutter_android","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/webview_flutter_android-3.12.0/","native_build":true,"dependencies":[]}],"macos":[{"name":"url_launcher_macos","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_macos-3.1.0/","native_build":true,"dependencies":[]}],"linux":[{"name":"url_launcher_linux","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_linux-3.1.0/","native_build":true,"dependencies":[]}],"windows":[{"name":"url_launcher_windows","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.0/","native_build":true,"dependencies":[]}],"web":[{"name":"url_launcher_web","path":"/Users/shegunmontcho/.pub-cache/hosted/pub.dev/url_launcher_web-2.2.0/","dependencies":[]}]},"dependencyGraph":[{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]},{"name":"webview_flutter","dependencies":["webview_flutter_android","webview_flutter_wkwebview"]},{"name":"webview_flutter_android","dependencies":[]},{"name":"webview_flutter_wkwebview","dependencies":[]}],"date_created":"2023-11-02 10:31:19.275852","version":"3.13.7"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,20 +33,20 @@ void successCallback(response, context) { | |
} | ||
} | ||
|
||
final kkiapay = KKiaPay( | ||
amount: 1000,// | ||
countries: ["BJ"],// | ||
phone: "22961000000",// | ||
name: "John Doe",// | ||
email: "[email protected]",// | ||
reason: 'transaction reason',// | ||
data: 'Fake data',// | ||
sandbox: true,// | ||
apikey: public_api_key,// | ||
callback: successCallback,// | ||
theme: defaultTheme, // Ex : "#222F5A", | ||
partnerId: 'AxXxXXxId',// | ||
paymentMethods: ["momo","card"]// | ||
const kkiapay = KKiaPay( | ||
amount: 1000, | ||
countries: ["BJ"], | ||
phone: "22961000000", | ||
name: "John Doe", | ||
email: "[email protected]", | ||
reason: 'transaction reason', | ||
data: 'Fake data', | ||
sandbox: true, | ||
apikey: public_api_key, | ||
callback: successCallback, | ||
theme: defaultTheme, | ||
partnerId: 'AxXxXXxId', | ||
paymentMethods: ["momo","card"] | ||
); | ||
|
||
class App extends StatelessWidget { | ||
|
@@ -57,10 +57,10 @@ class App extends StatelessWidget { | |
home: Scaffold( | ||
appBar: AppBar( | ||
backgroundColor: nColorPrimary, | ||
title: Text('Kkiapay Sample'), | ||
title: const Text('Kkiapay Sample'), | ||
centerTitle: true, | ||
), | ||
body: KkiapaySample(), | ||
body: const KkiapaySample(), | ||
), | ||
); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.