diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 0000000..c72eb33
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -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.
diff --git a/.github/workflows/change-review.yml b/.github/workflows/change-review.yml
index 60a1fa5..016b3b1 100644
--- a/.github/workflows/change-review.yml
+++ b/.github/workflows/change-review.yml
@@ -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()
diff --git a/.github/workflows/package-publish.yml b/.github/workflows/package-publish.yml
index 8ceb415..7992fb2 100644
--- a/.github/workflows/package-publish.yml
+++ b/.github/workflows/package-publish.yml
@@ -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()
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7ed5cd9..4e68f3c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
\ No newline at end of file
+
+- Initial release
diff --git a/README.md b/README.md
index bf6e4f4..510e5ad 100644
--- a/README.md
+++ b/README.md
@@ -1,21 +1,17 @@
-
-
-
+
# 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)
@@ -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`
@@ -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: "customer@customer.com"
- );
+ phoneNumber: "1234566677777",
+ email: "customer@customer.com"
+ );
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
@@ -119,8 +120,9 @@ Copyright (c) Flutterwave Inc.
- [fluttertoast](https://pub.dev/packages/fluttertoast)
-## 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)
diff --git a/example/.gitignore b/example/.gitignore
index f3c2053..79c113f 100644
--- a/example/.gitignore
+++ b/example/.gitignore
@@ -5,9 +5,12 @@
*.swp
.DS_Store
.atom/
+.build/
.buildlog/
.history
.svn/
+.swiftpm/
+migrate_working_dir/
# IntelliJ related
*.iml
@@ -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
diff --git a/example/.metadata b/example/.metadata
index 245a8e8..d77a4e0 100644
--- a/example/.metadata
+++ b/example/.metadata
@@ -1,11 +1,11 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
-# This file should be version controlled.
+# This file should be version controlled and should not be manually edited.
version:
- revision: 85684f9300908116a78138ea4c6036c35c9a1236
- channel: stable
+ revision: "c23637390482d4cf9598c3ce3f2be31aa7332daf"
+ channel: "stable"
project_type: app
@@ -13,11 +13,26 @@ project_type: app
migration:
platforms:
- platform: root
- create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
- base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
+ create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
- platform: android
- create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
- base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
+ create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ - platform: ios
+ create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ - platform: linux
+ create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ - platform: macos
+ create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ - platform: web
+ create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ - platform: windows
+ create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
# User provided section
diff --git a/example/README.md b/example/README.md
index 81f23a1..2b3fce4 100644
--- a/example/README.md
+++ b/example/README.md
@@ -1,4 +1,4 @@
-# flutterwave_beta
+# example
A new Flutter project.
@@ -8,9 +8,9 @@ This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
-- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
-- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
+- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
+- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
-For help getting started with Flutter, view our
-[online documentation](https://flutter.dev/docs), which offers tutorials,
+For help getting started with Flutter development, view the
+[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml
index 61b6c4d..0d29021 100644
--- a/example/analysis_options.yaml
+++ b/example/analysis_options.yaml
@@ -13,8 +13,7 @@ linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
- # and their documentation is published at
- # https://dart-lang.github.io/linter/lints/index.html.
+ # and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
diff --git a/example/android/.gitignore b/example/android/.gitignore
index 6f56801..be3943c 100644
--- a/example/android/.gitignore
+++ b/example/android/.gitignore
@@ -5,9 +5,10 @@ gradle-wrapper.jar
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
+.cxx/
# Remember to never publicly share your keystore.
-# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
+# See https://flutter.dev/to/reference-keystore
key.properties
**/*.keystore
**/*.jks
diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle
deleted file mode 100644
index ee6e033..0000000
--- a/example/android/app/build.gradle
+++ /dev/null
@@ -1,72 +0,0 @@
-def localProperties = new Properties()
-def localPropertiesFile = rootProject.file('local.properties')
-if (localPropertiesFile.exists()) {
- localPropertiesFile.withReader('UTF-8') { reader ->
- localProperties.load(reader)
- }
-}
-
-def flutterRoot = localProperties.getProperty('flutter.sdk')
-if (flutterRoot == null) {
- throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
-}
-
-def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
-if (flutterVersionCode == null) {
- flutterVersionCode = '1'
-}
-
-def flutterVersionName = localProperties.getProperty('flutter.versionName')
-if (flutterVersionName == null) {
- flutterVersionName = '1.0'
-}
-
-apply plugin: 'com.android.application'
-apply plugin: 'kotlin-android'
-apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
-
-android {
-// compileSdkVersion flutter.compileSdkVersion
- compileSdkVersion 32
- ndkVersion flutter.ndkVersion
-
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
-
- kotlinOptions {
- jvmTarget = '1.8'
- }
-
- sourceSets {
- main.java.srcDirs += 'src/main/kotlin'
- }
-
- defaultConfig {
- // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
- applicationId "com.example.example"
- // You can update the following values to match your application needs.
- // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
- minSdkVersion 19
- targetSdkVersion flutter.targetSdkVersion
- versionCode flutterVersionCode.toInteger()
- versionName flutterVersionName
- }
-
- buildTypes {
- release {
- // TODO: Add your own signing config for the release build.
- // Signing with the debug keys for now, so `flutter run --release` works.
- signingConfig signingConfigs.debug
- }
- }
-}
-
-flutter {
- source '../..'
-}
-
-dependencies {
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
-}
diff --git a/example/android/app/build.gradle.kts b/example/android/app/build.gradle.kts
new file mode 100644
index 0000000..d77dd1a
--- /dev/null
+++ b/example/android/app/build.gradle.kts
@@ -0,0 +1,44 @@
+plugins {
+ id("com.android.application")
+ id("kotlin-android")
+ // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
+ id("dev.flutter.flutter-gradle-plugin")
+}
+
+android {
+ namespace = "com.example.example"
+ compileSdk = flutter.compileSdkVersion
+ ndkVersion = "27.0.12077973"
+
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_11
+ targetCompatibility = JavaVersion.VERSION_11
+ }
+
+ kotlinOptions {
+ jvmTarget = JavaVersion.VERSION_11.toString()
+ }
+
+ defaultConfig {
+ // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
+ applicationId = "com.example.example"
+ // You can update the following values to match your application needs.
+ // For more information, see: https://flutter.dev/to/review-gradle-config.
+ minSdk = flutter.minSdkVersion
+ targetSdk = flutter.targetSdkVersion
+ versionCode = flutter.versionCode
+ versionName = flutter.versionName
+ }
+
+ buildTypes {
+ release {
+ // TODO: Add your own signing config for the release build.
+ // Signing with the debug keys for now, so `flutter run --release` works.
+ signingConfig = signingConfigs.getByName("debug")
+ }
+ }
+}
+
+flutter {
+ source = "../.."
+}
diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml
index 45d523a..399f698 100644
--- a/example/android/app/src/debug/AndroidManifest.xml
+++ b/example/android/app/src/debug/AndroidManifest.xml
@@ -1,5 +1,4 @@
-
+
+
+
+
+
+
+
diff --git a/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt
index e793a00..ac81bae 100644
--- a/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt
+++ b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt
@@ -2,5 +2,4 @@ package com.example.example
import io.flutter.embedding.android.FlutterActivity
-class MainActivity: FlutterActivity() {
-}
+class MainActivity : FlutterActivity()
diff --git a/example/android/app/src/profile/AndroidManifest.xml b/example/android/app/src/profile/AndroidManifest.xml
index 45d523a..399f698 100644
--- a/example/android/app/src/profile/AndroidManifest.xml
+++ b/example/android/app/src/profile/AndroidManifest.xml
@@ -1,5 +1,4 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ example
+
+
+
+
+
+