Skip to content

Commit 75305a9

Browse files
committed
remove logs
1 parent 7d8584f commit 75305a9

19 files changed

+379
-369
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## [1.0.5] - October, 2022
2+
* Fixed null when transaction is cancelled.
3+
* Removed modal pop up before launching web view.
4+
* Removed intermediate make payment screen before webview.
5+
* Deprecated FlutterwaveStyle.
6+
* Updated README file.
7+
18
## [1.0.4] - July 4, 2022
29
* Renamed property `isDebug` to `isTestMode`
310
* Made property `redirectUrl` required

README.md

+90-113
Original file line numberDiff line numberDiff line change
@@ -1,141 +1,118 @@
11

2-
<p align="center">
3-
<img title="Flutterwave" height="200" src="https://flutterwave.com/images/logo-colored.svg" width="50%"/>
4-
</p>
52

6-
# Flutterwave Flutter Standard SDK
3+
<p align="center">
4+
<img title="Flutterwave" height="200" src="https://flutterwave.com/images/logo/full.svg" width="50%"/>
5+
</p>
76

8-
## Table of Contents
7+
# Flutterwave Flutter SDK (Standard)
8+
9+
The Flutter library helps you create seamless payment experiences in your dart mobile app. By connecting to our modal, you can start collecting payment in no time.
910

10-
- [About](#about)
11-
- [Getting Started](#getting-started)
12-
- [Usage](#usage)
13-
- [Deployment](#deployment)
14-
- [Built Using](#build-tools)
15-
- [References](#references)
16-
- [Support](#support)
1711

18-
<a id="about"></a>
19-
## About
20-
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.
12+
Available features include:
2113

14+
- Collections: Card, Account, Mobile money, Bank Transfers, USSD, Barter.
15+
- Recurring payments: Tokenization and Subscriptions.
16+
- Split payments
2217

2318

24-
<a id="getting-started"></a>
19+
## Table of Contents
2520

26-
## Getting Started
21+
1. [Requirements](#requirements)
22+
2. [Installation](#installation)
23+
3. [Usage](#usage)
24+
4. [Support](#support)
25+
5. [Contribution guidelines](#contribution-guidelines)
26+
6. [License](#license)
2727

28-
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.
29-
See [references](#references) for links to dashboard and API documentation.
3028

3129
## Requirements
32-
- Ensure you have your test (and live) [API keys](https://developer.flutterwave.com/docs/api-keys).
33-
``` Flutter version >= 1.17.0 Flutterwave version 3 API keys ```
3430

35-
## Installation Add the dependency
31+
1. Flutterwave for business [API Keys](https://developer.flutterwave.com/docs/integration-guides/authentication)
32+
2. Supported Flutter version >= 1.17.0
33+
3634

37-
In your `pubspec.yaml` file add:
35+
## Installation
36+
37+
1. Add the dependency to your project. In your `pubspec.yaml` file add: `flutterwave_standard: 1.0.5`
38+
2. Run `flutter pub get`
3839

39-
1. `flutterwave_standard: ^1.0.4`
40-
2. run `flutter pub get`
41-
<a id="usage"></a>
4240

4341
## Usage
4442

45-
Create a `Flutterwave` instance by calling the constructor `Flutterwave` The constructor accepts a mandatory instance of the following:
46-
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.
47-
48-
_handlePaymentInitialization() async {
49-
final style = FlutterwaveStyle(
50-
appBarText: "My Standard Blue",
51-
buttonColor: Color(0xffd0ebff),
52-
appBarIcon: Icon(Icons.message, color: Color(0xffd0ebff)),
53-
buttonTextStyle: TextStyle(
54-
color: Colors.black,
55-
fontWeight: FontWeight.bold,
56-
fontSize: 18),
57-
appBarColor: Color(0xffd0ebff),
58-
dialogCancelTextStyle: TextStyle(
59-
color: Colors.redAccent,
60-
fontSize: 18
61-
),
62-
dialogContinueTextStyle: TextStyle(
63-
color: Colors.blue,
64-
fontSize: 18
65-
)
66-
);
67-
68-
final Customer customer = Customer(
69-
name: "FLW Developer",
70-
phoneNumber: "1234566677777",
71-
72-
);
73-
74-
final Flutterwave flutterwave = Flutterwave(
75-
context: context,
76-
style: style,
77-
publicKey: "Public Key,
78-
currency: "RWF",
79-
redirectUrl: "my_redirect_url"
80-
txRef: "unique_transaction_reference",
81-
amount: "3000",
82-
customer: customer,
83-
paymentOptions: "ussd, card, barter, payattitude",
84-
customization: Customization(title: "Test Payment"),
85-
isDebug: true
86-
);
87-
}
88-
89-
### 2. Handle the response
90-
91-
Calling the `.charge()` method returns a `Future`
92-
of `ChargeResponse` which we await for the actual response as seen above.
93-
94-
95-
96-
final ChargeResponse response = await flutterwave.charge();
97-
if (response != null) {
98-
print(response.toJson());
99-
if(response.success) {
100-
Call the verify transaction endpoint with the transactionID returned in `response.transactionId` to verify transaction before offering value to customer
101-
} else {
102-
// Transaction not successful
103-
}
104-
} else {
105-
// User cancelled
106-
}
107-
108-
#### Please note that:
109-
- `ChargeResponse` can be null, depending on if the user cancels
110-
the transaction by pressing back.
111-
- 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
112-
113-
> **PLEASE NOTE**
114-
115-
> We advise you to do a further verification of transaction's details on your server to be sure everything checks out before providing service.
116-
<a id="deployment"></a>
117-
118-
119-
##Testing
120-
`pub run test`
121-
122-
## Debugging Errors
123-
We understand that you may run into some errors while integrating our library. You can read more about our error messages [here](https://developer.flutterwave.com/docs/integration-guides/errors).
124-
125-
For `authorization` and `validation` error responses, double-check your API keys and request. If you get a `server` error, kindly engage the team for support.
126-
127-
<a id="support"></a>
128-
## Support For additional assistance using this library, contact the developer experience (DX) team via [email](mailto:[email protected]) or on [slack](https://bit.ly/34Vkzcg).
129-
130-
You can also follow us [@FlutterwaveEng](https://twitter.com/FlutterwaveEng) and let us know what you think 😊
43+
### Initializing a Flutterwave instance
44+
45+
To create an instance, you should call the Flutterwave constructor. This constructor accepts a mandatory instance of the following:
46+
47+
- The calling `Context`
48+
- `publicKey`
49+
- `Customer`
50+
- `amount`
51+
- `email`
52+
- `fullName`
53+
- `txRef`
54+
- `isTestMode`
55+
- `paymentOptions`
56+
- `redirectUrl`
57+
- `Customization`
58+
59+
It returns an instance of Flutterwave which we then call the async method `.charge()` on.
60+
61+
_
62+
63+
handlePaymentInitialization() async {
64+
final Customer customer = Customer(
65+
name: "Flutterwave Developer",
66+
phoneNumber: "1234566677777",
67+
68+
);
69+
final Flutterwave flutterwave = Flutterwave(
70+
context: context, publicKey: "Public Key-here,
71+
currency: "currency-here",
72+
redirectUrl: "add-your-redirect-url-here"
73+
txRef: "add-your-unique-reference-here",
74+
amount: "3000",
75+
customer: customer,
76+
paymentOptions: "ussd, card, barter, payattitude",
77+
customization: Customization(title: "My Payment"),
78+
isTestMode: true );
79+
}
80+
81+
### Handling the response
82+
83+
Calling the `.charge()` method returns a `Future` of `ChargeResponse` which we await for the actual response as seen above.
84+
85+
86+
87+
final ChargeResponse response = await flutterwave.charge();
88+
89+
Call the verify transaction [endpoint](https://developer.flutterwave.com/docs/verifications/transaction) with the `transactionID` returned in `response.transactionId` or the `txRef` you provided to verify transaction before offering value to customer
90+
91+
#### Note
92+
93+
- `ChargeResponse` can be null, depending on if the user cancels the transaction by pressing back.
94+
- You need to confirm the transaction is successful. Ensure that the txRef, amount, and status are correct and successful. Be sure to [verify the transaction details](https://developer.flutterwave.com/docs/verifications/transaction) before providing value.
95+
- Some payment methods are not instant, such a `Pay with Bank Transfers, Pay with Bank`, and so you would need to rely on [webhooks](https://developer.flutterwave.com/docs/integration-guides/webhooks) or call the transaction verification service using the [`transactionId`](https://developer.flutterwave.com/reference/endpoints/transactions#verify-a-transaction), or transaction reference you created(`txRef`)
96+
- For such long payments like the above, closing the payment page returns a `cancelled` status, so your final source of truth has to be calling the transaction verification service.
97+
98+
## Support
99+
100+
For additional assistance using this library, contact the developer experience (DX) team via [email](mailto:[email protected]) or on [slack](https://bit.ly/34Vkzcg).
101+
102+
You can also follow us [@FlutterwaveEng](https://twitter.com/FlutterwaveEng) and let us know what you think 😊.
131103

132104
## Contribution guidelines
105+
133106
Read more about our community contribution guidelines [here](https://www.notion.so/flutterwavego/Community-contribution-guide-ca1d8a876ba04d45ab4b663c758ae42a).
134107

135108
## License
136-
By contributing to the Flutter library, you agree that your contributions will be licensed under its [MIT license](https://opensource.org/licenses/MIT).
109+
110+
By contributing to the Flutter library, you agree that your contributions will be licensed under its [MIT license](/LICENSE).
111+
112+
Copyright (c) Flutterwave Inc.
137113

138114
## Built Using
115+
139116
- [flutter](https://flutter.dev/)
140117
- [http](https://pub.dev/packages/http)
141118
- [flutter_inappwebview](https://pub.dev/packages/flutter_inappwebview)

example/android/app/build.gradle

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

2828
android {
29-
compileSdkVersion flutter.compileSdkVersion
29+
// compileSdkVersion flutter.compileSdkVersion
30+
compileSdkVersion 32
3031
ndkVersion flutter.ndkVersion
3132

3233
compileOptions {
@@ -47,7 +48,7 @@ android {
4748
applicationId "com.example.example"
4849
// You can update the following values to match your application needs.
4950
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
50-
minSdkVersion 17
51+
minSdkVersion 19
5152
targetSdkVersion flutter.targetSdkVersion
5253
versionCode flutterVersionCode.toInteger()
5354
versionName flutterVersionName

example/lib/main.dart

+7-47
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutterwave_standard/flutterwave.dart';
3-
import 'package:flutterwave_standard/models/subaccount.dart';
43
import 'package:uuid/uuid.dart';
54

65
void main() {
@@ -151,9 +150,8 @@ class _MyHomePageState extends State<MyHomePage> {
151150
width: double.infinity,
152151
height: 50,
153152
margin: EdgeInsets.fromLTRB(0, 20, 0, 10),
154-
child: RaisedButton(
153+
child: ElevatedButton(
155154
onPressed: this._onPressed,
156-
color: Colors.blue,
157155
child: Text(
158156
"Make Payment",
159157
style: TextStyle(color: Colors.white),
@@ -174,75 +172,37 @@ class _MyHomePageState extends State<MyHomePage> {
174172
}
175173

176174
_handlePaymentInitialization() async {
177-
final style = FlutterwaveStyle(
178-
appBarText: "My Standard Blue",
179-
buttonColor: Color(0xffd0ebff),
180-
buttonTextStyle: TextStyle(
181-
color: Colors.deepOrangeAccent,
182-
fontSize: 16,
183-
),
184-
appBarColor: Color(0xff8fa33b),
185-
dialogCancelTextStyle: TextStyle(
186-
color: Colors.brown,
187-
fontSize: 18,
188-
),
189-
dialogContinueTextStyle: TextStyle(
190-
color: Colors.purpleAccent,
191-
fontSize: 18,
192-
),
193-
mainBackgroundColor: Colors.indigo,
194-
mainTextStyle: TextStyle(
195-
color: Colors.indigo,
196-
fontSize: 19,
197-
letterSpacing: 2
198-
),
199-
dialogBackgroundColor: Colors.greenAccent,
200-
appBarIcon: Icon(Icons.message, color: Colors.purple),
201-
buttonText: "Pay $selectedCurrency${amountController.text}",
202-
appBarTitleTextStyle: TextStyle(
203-
color: Colors.purpleAccent,
204-
fontSize: 18,
205-
),
206-
);
207-
208175
final Customer customer = Customer(
209176
name: "FLW Developer",
210177
phoneNumber: this.phoneNumberController.text ?? "12345678",
211178
email: "[email protected]");
212-
213-
final subAccounts = [
214-
SubAccount(id: "RS_1A3278129B808CB588B53A14608169AD", transactionChargeType: "flat", transactionPercentage: 25),
215-
SubAccount(id: "RS_C7C265B8E4B16C2D472475D7F9F4426A", transactionChargeType: "flat", transactionPercentage: 50)
216-
];
217179

218180
final Flutterwave flutterwave = Flutterwave(
219181
context: context,
220-
style: style,
221182
publicKey: this.publicKeyController.text.trim().isEmpty
222183
? this.getPublicKey()
223184
: this.publicKeyController.text.trim(),
224185
currency: this.selectedCurrency,
225-
redirectUrl: "https://google.com",
186+
redirectUrl: 'https://facebook.com',
226187
txRef: Uuid().v1(),
227188
amount: this.amountController.text.toString().trim(),
228189
customer: customer,
229190
// subAccounts: subAccounts,
230-
paymentOptions: "card, payattitude, barter",
191+
paymentOptions: "card, payattitude, barter, bank transfer, ussd",
231192
customization: Customization(title: "Test Payment"),
232-
isTestMode: false);
193+
isTestMode: this.isTestMode);
233194
final ChargeResponse response = await flutterwave.charge();
234195
if (response != null) {
235-
this.showLoading(response.status);
196+
this.showLoading(response.toString());
236197
print("${response.toJson()}");
237198
} else {
238199
this.showLoading("No Response!");
239200
}
240201
}
241202

242203
String getPublicKey() {
243-
if (isTestMode) return "FLWPUBK_TEST-895362a74986153380262d89bfdc9b8a-X";
244-
// "FLWPUBK_TEST-02b9b5fc6406bd4a41c3ff141cc45e93-X";
245-
return "FLWPUBK-aa4cd0b443404147d2d8229a37694b00-X";
204+
if (isTestMode) return "FLWPUBK_TEST--X";
205+
return "FLWPUBK--X";
246206
}
247207

248208
void _openBottomSheet() {

0 commit comments

Comments
 (0)