Skip to content

Commit 93d780e

Browse files
committed
initial commit
0 parents  commit 93d780e

File tree

87 files changed

+3494
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+3494
-0
lines changed

.gitignore

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
12+
# IntelliJ related
13+
*.iml
14+
*.ipr
15+
*.iws
16+
.idea/
17+
18+
# The .vscode folder contains launch configuration and tasks you configure in
19+
# VS Code which you may wish to be included in version control, so this line
20+
# is commented out by default.
21+
#.vscode/
22+
23+
# Flutter/Dart/Pub related
24+
**/doc/api/
25+
.dart_tool/
26+
.flutter-plugins
27+
.flutter-plugins-dependencies
28+
.packages
29+
.pub-cache/
30+
.pub/
31+
build/
32+
33+
# Android related
34+
**/android/**/gradle-wrapper.jar
35+
**/android/.gradle
36+
**/android/captures/
37+
**/android/gradlew
38+
**/android/gradlew.bat
39+
**/android/local.properties
40+
**/android/**/GeneratedPluginRegistrant.java
41+
42+
# iOS/XCode related
43+
**/ios/**/*.mode1v3
44+
**/ios/**/*.mode2v3
45+
**/ios/**/*.moved-aside
46+
**/ios/**/*.pbxuser
47+
**/ios/**/*.perspectivev3
48+
**/ios/**/*sync/
49+
**/ios/**/.sconsign.dblite
50+
**/ios/**/.tags*
51+
**/ios/**/.vagrant/
52+
**/ios/**/DerivedData/
53+
**/ios/**/Icon?
54+
**/ios/**/Pods/
55+
**/ios/**/.symlinks/
56+
**/ios/**/profile
57+
**/ios/**/xcuserdata
58+
**/ios/.generated/
59+
**/ios/Flutter/App.framework
60+
**/ios/Flutter/Flutter.framework
61+
**/ios/Flutter/Flutter.podspec
62+
**/ios/Flutter/Generated.xcconfig
63+
**/ios/Flutter/app.flx
64+
**/ios/Flutter/app.zip
65+
**/ios/Flutter/flutter_assets/
66+
**/ios/Flutter/flutter_export_environment.sh
67+
**/ios/ServiceDefinitions.json
68+
**/ios/Runner/GeneratedPluginRegistrant.*
69+
70+
# Exceptions to above rules.
71+
!**/ios/**/default.mode1v3
72+
!**/ios/**/default.mode2v3
73+
!**/ios/**/default.pbxuser
74+
!**/ios/**/default.perspectivev3

.metadata

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: c5a4b4029c0798f37c4a39b479d7cb75daa7b05c
8+
channel: stable
9+
10+
project_type: package

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## [1.0.0] - September 9, 2021.
2+
* Initial release

LICENSE

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
```
2+
3+
Flutterwave's Flutter SDK
4+
5+
MIT License
6+
7+
8+
9+
Copyright (c) 2021
10+
11+
12+
13+
Permission is hereby granted, free of charge, to any person obtaining a copy
14+
15+
of this software and associated documentation files (the "Software"), to deal
16+
17+
in the Software without restriction, including without limitation the rights
18+
19+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20+
21+
copies of the Software, and to permit persons to whom the Software is
22+
23+
furnished to do so, subject to the following conditions:
24+
25+
26+
27+
The above copyright notice and this permission notice shall be included in all
28+
29+
copies or substantial portions of the Software.
30+
31+
32+
33+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34+
35+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36+
37+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38+
39+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40+
41+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42+
43+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
44+
45+
SOFTWARE.
46+
47+
```

README.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
<p align="center">
2+
<img title="Flutterwave" height="200" src="https://flutterwave.com/images/logo-colored.svg" width="50%"/>
3+
</p>
4+
5+
# Flutterwave Flutter Standard SDK
6+
7+
## Table of Contents
8+
9+
- [About](#about)
10+
- [Getting Started](#getting-started)
11+
- [Usage](#usage)
12+
- [Deployment](#deployment)
13+
- [Built Using](#build-tools)
14+
- [References](#references)
15+
- [Support](#support)
16+
17+
<a id="about"></a>
18+
## About
19+
Flutterwave's Flutter SDK is Flutterwave's offical flutter sdk to integrate Flutterwave's [Standard](https://developer.flutterwave.com/docs/flutterwave-standard) payment into your flutter app. It comes with a ready made Drop In UI.
20+
21+
22+
23+
<a id="getting-started"></a>
24+
25+
## Getting Started
26+
27+
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See [deployment](#deployment) for notes on how to deploy the project on a live system.
28+
See [references](#references) for links to dashboard and API documentation.
29+
30+
### Prerequisite
31+
32+
- Ensure you have your test (and live) [API keys](https://developer.flutterwave.com/docs/api-keys).
33+
```
34+
Flutter version >= 1.17.0
35+
Flutterwave version 3 API keys
36+
```
37+
38+
### Installing
39+
40+
**Step 1.** Add the dependency
41+
42+
In your `pubspec.yaml` file add:
43+
44+
1. `flutterwave_standard: 1.0.0`
45+
2. run `flutter pub get`
46+
47+
<a id="usage"></a>
48+
## Usage
49+
50+
### 1. Create a `Flutterwave` instance
51+
52+
Create a `Flutterwave` instance by calling the constructor `Flutterwave` The constructor accepts a mandatory instance of the following:
53+
the calling `Context` , `publicKey`, `Customer`, `amount`, `currency`, `email`, `fullName`, `txRef`, `isDebug`, `paymentOptions`, and `Customization` . It returns an instance of `Flutterwave` which we then call the `async` method `.charge()` on.
54+
55+
_handlePaymentInitialization() async {
56+
final style = FlutterwaveStyle(
57+
appBarText: "My Standard Blue",
58+
buttonColor: Color(0xffd0ebff),
59+
appBarIcon: Icon(Icons.message, color: Color(0xffd0ebff)),
60+
buttonTextStyle: TextStyle(
61+
color: Colors.black,
62+
fontWeight: FontWeight.bold,
63+
fontSize: 18,
64+
),
65+
appBarColor: Color(0xffd0ebff),
66+
dialogCancelTextStyle: TextStyle(
67+
color: Colors.redAccent,
68+
fontSize: 18,
69+
),
70+
dialogContinueTextStyle: TextStyle(
71+
color: Colors.blue,
72+
fontSize: 18,
73+
)
74+
);
75+
final Customer customer = Customer(
76+
name: "FLW Developer",
77+
phoneNumber: "1234566677777",
78+
email: "customer@customer.com");
79+
80+
final Flutterwave flutterwave = Flutterwave(
81+
context: context,
82+
style: style,
83+
publicKey: "Public Key,
84+
currency: "RWF",
85+
txRef: "unique_transaction_reference",
86+
amount: "3000",
87+
customer: customer,
88+
paymentOptions: "ussd, card, barter, payattitude",
89+
customization: Customization(title: "Test Payment"),
90+
isDebug: true);
91+
}
92+
93+
94+
### 2. Handle the response
95+
96+
Calling the `.charge()` method returns a `Future`
97+
of `ChargeResponse` which we await for the actual response as seen above.
98+
99+
```
100+
final ChargeResponse response = await flutterwave.charge();
101+
if (response != null) {
102+
print(response.toJson());
103+
if(response.success) {
104+
Call the verify transaction endpoint with the transactionID returned in `response.transactionId` to verify transaction before offering value to customer
105+
} else {
106+
// Transaction not successful
107+
}
108+
} else {
109+
// User cancelled
110+
}
111+
```
112+
113+
114+
115+
#### Please note that:
116+
- `ChargeResponse` can be null, depending on if the user cancels
117+
the transaction by pressing back.
118+
- You need to check the status of the transaction from the instance of `ChargeResponse` returned from calling `.charge()`, the `status`, `success` and `txRef` are successful and correct before providing value to the customer
119+
120+
> **PLEASE NOTE**
121+
122+
> We advise you to do a further verification of transaction's details on your server to be sure everything checks out before providing service.
123+
<a id="deployment"></a>
124+
## Deployment
125+
126+
- Switch to Live Mode on the Dashboard settings page
127+
- Use the Live Public API key from the API tab, see [here](https://developer.flutterwave.com/docs/api-keys) for more details.
128+
129+
<a id="build-tools"></a>
130+
## Built Using
131+
- [flutter](https://flutter.dev/)
132+
- [http](https://pub.dev/packages/http)
133+
- [webview_flutter](https://pub.dev/packages/webview_flutter)
134+
- [fluttertoast](https://pub.dev/packages/fluttertoast)
135+
136+
<a id="references"></a>
137+
## Flutterwave API References
138+
139+
- [Flutterwave API Doc](https://developer.flutterwave.com/docs)
140+
- [Flutterwave Inline Payment Doc](https://developer.flutterwave.com/docs/flutterwave-inline)
141+
- [Flutterwave Dashboard](https://dashboard.flutterwave.com/login)
142+
143+
<a id="support"></a>
144+
## Support
145+
* Have issues integrating? Reach out via [our Developer forum](https://developer.flutterwave.com/discuss) for support
146+

example/.gitignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
12+
# IntelliJ related
13+
*.iml
14+
*.ipr
15+
*.iws
16+
.idea/
17+
18+
# The .vscode folder contains launch configuration and tasks you configure in
19+
# VS Code which you may wish to be included in version control, so this line
20+
# is commented out by default.
21+
#.vscode/
22+
23+
# Flutter/Dart/Pub related
24+
**/doc/api/
25+
**/ios/Flutter/.last_build_id
26+
.dart_tool/
27+
.flutter-plugins
28+
.flutter-plugins-dependencies
29+
.packages
30+
.pub-cache/
31+
.pub/
32+
/build/
33+
34+
# Web related
35+
lib/generated_plugin_registrant.dart
36+
37+
# Symbolication related
38+
app.*.symbols
39+
40+
# Obfuscation related
41+
app.*.map.json
42+
43+
# Exceptions to above rules.
44+
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages

example/.metadata

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: fba99f6cf9a14512e461e3122c8ddfaa25394e89
8+
channel: stable
9+
10+
project_type: app

example/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# flutterwave_beta
2+
3+
A new Flutter project.
4+
5+
## Getting Started
6+
7+
This project is a starting point for a Flutter application.
8+
9+
A few resources to get you started if this is your first Flutter project:
10+
11+
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12+
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
13+
14+
For help getting started with Flutter, view our
15+
[online documentation](https://flutter.dev/docs), which offers tutorials,
16+
samples, guidance on mobile development, and a full API reference.

example/android/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
gradle-wrapper.jar
2+
/.gradle
3+
/captures/
4+
/gradlew
5+
/gradlew.bat
6+
/local.properties
7+
GeneratedPluginRegistrant.java
8+
9+
# Remember to never publicly share your keystore.
10+
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11+
key.properties

0 commit comments

Comments
 (0)