Skip to content

Performance Improvement | Documentation Update #54

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

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
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
55 changes: 28 additions & 27 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.
- Recurring payments: Tokenization and Subscriptions.
- Split payments


## Table of Contents

1. [Requirements](#requirements)
Expand All @@ -25,19 +21,16 @@ 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


## Installation

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


## Usage

### Initializing a Flutterwave instance
Expand All @@ -58,33 +51,40 @@ 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",
context: context,
publicKey: "YOUR-PUBLIC-KEY",
currency: "currency-here",
redirectUrl: "add-your-redirect-url-here",
txRef: "add-your-unique-reference-here",
amount: "3000",
/// ADDING A SUB ACCOUNT LOOKS LIKE THIS
subAccounts: [
SubAccount(
id: "2333EDEd_",
transactionChargeType: TransactionChargeType.percentage,
transactionCharge: 0.5,
),
],
customer: customer,
paymentOptionsList: [PaymentOption.card, PaymentOption.payattitude, PaymentOption.barter, PaymentOption.banktransfer, PaymentOption.ussd],
customization: Customization(title: "My Payment"),
isTestMode: true );
}
isTestMode: true);
}

### 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();

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

Expand All @@ -103,7 +103,7 @@ You can also follow us [@FlutterwaveEng](https://twitter.com/FlutterwaveEng) and

## Contribution guidelines

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

## License

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

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

## Flutterwave API References

- [Flutterwave API Doc](https://developer.flutterwave.com/docs)
- [Flutterwave Inline Payment Doc](https://developer.flutterwave.com/docs/flutterwave-inline)
Expand Down
4 changes: 2 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if (localPropertiesFile.exists()) {

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.")
throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
Expand All @@ -27,7 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
// compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 32
compileSdkVersion 33
ndkVersion flutter.ndkVersion

compileOptions {
Expand Down
14 changes: 13 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutterwave_standard/flutterwave.dart';
import 'package:flutterwave_standard/models/subaccount.dart';
import 'package:flutterwave_standard/utils/enums/payment_option.dart';
import 'package:flutterwave_standard/utils/enums/transaction_charge_type.dart';
import 'package:uuid/uuid.dart';

void main() {
Expand Down Expand Up @@ -182,8 +185,17 @@ class _MyHomePageState extends State<MyHomePage> {
redirectUrl: 'https://facebook.com',
txRef: Uuid().v1(),
amount: this.amountController.text.toString().trim(),

/// ADDING A SUB ACCOUNT LOOKS LIKE THIS
subAccounts: [
SubAccount(
id: "2333EDEd_",
transactionChargeType: TransactionChargeType.percentage,
transactionCharge: 0.5,
),
],
customer: customer,
paymentOptions: "card, payattitude, barter, bank transfer, ussd",
paymentOptionsList: [PaymentOption.card, PaymentOption.payattitude, PaymentOption.barter, PaymentOption.banktransfer, PaymentOption.ussd],
customization: Customization(title: "Test Payment"),
isTestMode: this.isTestMode);
final ChargeResponse response = await flutterwave.charge();
Expand Down
Loading