Skip to content

Pull changes from the dev branch #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Developer Support Forum
url: https://forum.flutterwave.com
about: If you're having general trouble with your integration, Kindly contact our support team.
25 changes: 14 additions & 11 deletions .github/workflows/change-review.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,51 @@

name: Code Quality Check
name: Review changes on Dev (Commits/PRs)

on:
push:
branched: ['develop']
branches: ['dev']
pull_request:
types:
- opened

jobs:
version:
name: Code Checks
name: code-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up flutter environment
- name: checkout code
uses: actions/checkout@v2

- name: setup flutter environment
uses: subosito/flutter-action@v2
with:
flutter-version: '3.0.0'

- name: Install dependencies
- name: install flutter dependencies
run: flutter pub get

- name: Run unit tests
- name: run coverage tests
run: flutter test --coverage

- name: Install lcov
- name: install lcov for coverage reporting
run: sudo apt-get install -y lcov

- name: Remove irrelevant files from coverage
- name: remove irrelevant files from coverage report
run: lcov --remove coverage/lcov.info 'lib/view/*.dart' 'lib/*/*.freezed.dart' 'lib/*/*.g.dart' 'lib/*/*.part.dart' 'lib/generated/*.dart' 'lib/generated/*/*.dart' -o coverage/lcov.info

- name: Upload coverage report to Codecov
- name: upload coverage report to Codecov
uses: codecov/codecov-action@v2
with:
file: coverage/lcov.info
token: ${{ secrets.CODECOV_TOKEN }}

- name: push build status to Slack
- name: push build status to slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}
if: always()

67 changes: 45 additions & 22 deletions .github/workflows/package-publish.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,59 @@

name: Publish to Pub.dev
name: Publish changes to Pub.dev

on:
push:
branched: ['master']
release:
types: [created]

jobs:
version:
name: Code Checks
check-readme-and-changelog:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2

- name: check for changes in readme and changelog files
run: |
if ! git diff --quiet HEAD~ HEAD -- README.md CHANGELOG.md; then
echo "README and/or CHANGELOG have been modified. Proceeding with deployment."
else
echo "README and/or CHANGELOG have not been modified. Terminating deployment."
exit 1
fi

- name: push build status to slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}
if: always()

publish:
needs: check-readme-and-changelog
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up flutter environment
- name: checkout code
uses: actions/checkout@v2

- name: setup flutter environment
uses: subosito/flutter-action@v2
with:
flutter-version: '3.0.0'

- name: Install dependencies
- name: install flutter dependencies
run: flutter pub get

- name: Run unit tests
run: flutter test --coverage

# - name: Publish to Pub.dev
# run: pub publish --dry-run
- name: Publish to Pub.dev
run: pub publish --dry-run

- name: push build status to Slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()

uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}
if: always()
53 changes: 37 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,52 @@
## [1.1.0] | 2025-04-10

### Version Changes

- Modified `Flutterwave.charge()` method to accept a BuildContext parameter.
- Added context.mounted checks to prevent setState calls after widget disposal.
- Enhanced success status check logic to handle different status values ("success" and "completed").
- Improved error handling and state management.
- Removed deprecated components: `flutterwave_style.dart` and `standard_webview.dart`.
- Updated SDK requirements to `>=2.17.0`.
- Upgraded dependencies to latest versions.
- Removed unused dependencies: webview_flutter, modal_bottom_sheet and uuid.

## [1.0.7] - February, 2023
* Fixed iOS bug where webview couldn't close when close buttons are clicked
* Removed required `name` and `phone number` fields in `Customer` object

- Fixed iOS bug where webview couldn't close when close buttons are clicked
- Removed required `name` and `phone number` fields in `Customer` object

## [1.0.6] - October, 2022
* Fixed bug where transaction gets stuck after redirecting on webview
* Fixed iOS build bug by removing inAppBrowser library

- Fixed bug where transaction gets stuck after redirecting on webview
- Fixed iOS build bug by removing inAppBrowser library

## [1.0.5] - October, 2022
* Fixed null when transaction is cancelled.
* Removed modal pop up before launching web view.
* Removed intermediate make payment screen before webview.
* Deprecated FlutterwaveStyle.
* Updated README file.

- Fixed null when transaction is cancelled.
- Removed modal pop up before launching web view.
- Removed intermediate make payment screen before webview.
- Deprecated FlutterwaveStyle.
- Updated README file.

## [1.0.4] - July 4, 2022
* Renamed property `isDebug` to `isTestMode`
* Made property `redirectUrl` required
* Updated README file

- Renamed property `isDebug` to `isTestMode`
- Made property `redirectUrl` required
- Updated README file

## [1.0.3] - October 4, 2021.
* Fixed issue with webview

- Fixed issue with webview

## [1.0.2] - September 23, 2021.
* Fixed bug where cancel payment buttons are not clickable on iOS devices.

- Fixed bug where cancel payment buttons are not clickable on iOS devices.

## [1.0.1] - September 14, 2021.
* Fixed bug where response is not returned to initiating screen when user cancels transaction.

- Fixed bug where response is not returned to initiating screen when user cancels transaction.

## [1.0.0] - September 9, 2021.
* Initial release

- Initial release
68 changes: 35 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@


<p align="center">
<img title="Flutterwave" height="200" src="https://flutterwave.com/images/logo/full.svg" width="50%"/>
</p>
</p>

# Flutterwave Flutter SDK (Standard)

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.


Available features include:

- Collections: Card, Account, Mobile money, Bank Transfers, USSD, Barter.
- Collections: Card, Account, Mobile money, Bank Transfers, USSD.
- Recurring payments: Tokenization and Subscriptions.
- Split payments


## Table of Contents

1. [Requirements](#requirements)
Expand All @@ -25,26 +21,24 @@ Available features include:
5. [Contribution guidelines](#contribution-guidelines)
6. [License](#license)


## Requirements

1. Flutterwave for business [API Keys](https://developer.flutterwave.com/docs/integration-guides/authentication)
2. Supported Flutter version >= 1.17.0

3. Dart SDK >= 2.17.0
4. For Android: Ensure NDK version >= 27.0.12077973 on your project's android/app/build.gradle.kts file with android { ndkVersion = "27.0.12077973" }

## Installation

1. Add the dependency to your project. In your `pubspec.yaml` file add: `flutterwave_standard: 1.0.7`
1. Add the dependency to your project. In your `pubspec.yaml` file add: `flutterwave_standard: 1.1.0`
2. Run `flutter pub get`


## Usage

### Initializing a Flutterwave instance

To create an instance, you should call the Flutterwave constructor. This constructor accepts a mandatory instance of the following:

- The calling `Context`
- `publicKey`
- `Customer`
- `amount`
Expand All @@ -58,41 +52,48 @@ To create an instance, you should call the Flutterwave constructor. This constru

It returns an instance of Flutterwave which we then call the async method `.charge()` on.

_
\_

handlePaymentInitialization() async {
handlePaymentInitialization() async {
final Customer customer = Customer(
name: "Flutterwave Developer",
phoneNumber: "1234566677777",
email: "[email protected]"
);
phoneNumber: "1234566677777",
email: "[email protected]"
);
final Flutterwave flutterwave = Flutterwave(
context: context, publicKey: "Public Key-here",
currency: "currency-here",
redirectUrl: "add-your-redirect-url-here",
txRef: "add-your-unique-reference-here",
amount: "3000",
customer: customer,
paymentOptions: "ussd, card, barter, payattitude",
publicKey: "Public Key-here",
currency: "currency-here",
redirectUrl: "add-your-redirect-url-here",
txRef: "add-your-unique-reference-here",
amount: "3000",
customer: customer,
paymentOptions: "ussd, card, bank transfer",
customization: Customization(title: "My Payment"),
isTestMode: true );
}

### Handling the response
final ChargeResponse response = await flutterwave.charge(context);

Calling the `.charge()` method returns a `Future` of `ChargeResponse` which we await for the actual response as seen above.
// Handle the response
if (response.success == true) {
// Payment was successful
} else {
// Payment failed or was cancelled
}
}

### Handling the response

Calling the `.charge()` method returns a `Future` of `ChargeResponse` which we await for the actual response as seen above.

final ChargeResponse response = await flutterwave.charge();
final ChargeResponse response = await flutterwave.charge(context);

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
Call the verify transaction [endpoint](https://developer.flutterwave.com/docs/transaction-verification) with the `transactionID` returned in `response.transactionId` or the `txRef` you provided to verify transaction before offering value to customer

#### Note

- `ChargeResponse` can be null, depending on if the user cancels the transaction by pressing back.
- 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.
- 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`)
- 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/transaction-verification) before providing value.
- 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/webhooks) or call the transaction verification service using the [`transactionId`](https://developer.flutterwave.com/reference/verify-transaction), or transaction reference you created(`txRef`)
- 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.

## Support
Expand All @@ -119,8 +120,9 @@ Copyright (c) Flutterwave Inc.
- [fluttertoast](https://pub.dev/packages/fluttertoast)

<a id="references"></a>
## Flutterwave API References

- [Flutterwave API Doc](https://developer.flutterwave.com/docs)
- [Flutterwave Inline Payment Doc](https://developer.flutterwave.com/docs/flutterwave-inline)
## Flutterwave API References

- [Flutterwave API Doc](https://developer.flutterwave.com)
- [Flutterwave Inline Payment Doc](https://developer.flutterwave.com/docs/inline)
- [Flutterwave Dashboard](https://dashboard.flutterwave.com/login)
13 changes: 7 additions & 6 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
*.iml
Expand All @@ -26,19 +29,17 @@
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Exceptions to above rules.
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
Loading
Loading