flutterwave_standard 1.0.4 copy "flutterwave_standard: ^1.0.4" to clipboard
flutterwave_standard: ^1.0.4 copied to clipboard

Flutterwave's official library that wraps the standard implementation.

Flutterwave Flutter Standard SDK #

Table of Contents #

About #

Flutterwave's Flutter SDK is Flutterwave's offical flutter sdk to integrate Flutterwave's Standard payment into your flutter app. It comes with a ready made Drop In UI.

Getting Started #

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
See references for links to dashboard and API documentation.

Requirements #

  • Ensure you have your test (and live) API keys.
    Flutter version >= 1.17.0 Flutterwave version 3 API keys

Installation Add the dependency #

In your pubspec.yaml file add:

  1. flutterwave_standard: ^1.0.4
  2. run flutter pub get

Usage #

Create a Flutterwave instance by calling the constructor Flutterwave The constructor accepts a mandatory instance of the following:
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.

_handlePaymentInitialization() async { 
final style = FlutterwaveStyle(
 appBarText: "My Standard Blue", 
 buttonColor: Color(0xffd0ebff), 
 appBarIcon: Icon(Icons.message, color: Color(0xffd0ebff)),
 buttonTextStyle: TextStyle( 
     color: Colors.black, 
     fontWeight: FontWeight.bold, 
     fontSize: 18), 
appBarColor: Color(0xffd0ebff), 
dialogCancelTextStyle: TextStyle(
    color: Colors.redAccent, 
    fontSize: 18
    ),
dialogContinueTextStyle: TextStyle(
	    color: Colors.blue, 
	    fontSize: 18
	    ) 
	  ); 

final Customer customer = Customer(
	    name: "FLW Developer", 
	    phoneNumber: "1234566677777", 
	    email: "customer@customer.com"
	    );  
	    
final Flutterwave flutterwave = Flutterwave(
	    context: context, 
	    style: style, 
	    publicKey: "Public Key, 
	    currency: "RWF", 
	    redirectUrl: "my_redirect_url" 
	    txRef: "unique_transaction_reference", 
	    amount: "3000", 
	    customer: customer, 
	    paymentOptions: "ussd, card, barter, payattitude", 
	    customization: Customization(title: "Test Payment"),
	    isDebug: true
	    ); 
	} 

2. Handle 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(); 
 if (response != null) { 
     print(response.toJson()); 
	 if(response.success) { 
	 Call the verify transaction endpoint with the transactionID returned in `response.transactionId` to verify transaction before offering value to customer 
	 } else { 
	  // Transaction not successful 
	} 
 } else {
  // User cancelled 
 }

Please note that:

  • ChargeResponse can be null, depending on if the user cancels
    the transaction by pressing back.
  • 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

PLEASE NOTE

We advise you to do a further verification of transaction's details on your server to be sure everything checks out before providing service.

##Testing pub run test

Debugging Errors #

We understand that you may run into some errors while integrating our library. You can read more about our error messages here.

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.

Support For additional assistance using this library, contact the developer experience (DX) team via email or on slack. #

You can also follow us @FlutterwaveEng and let us know what you think 😊

Contribution guidelines #

Read more about our community contribution guidelines here.

License #

By contributing to the Flutter library, you agree that your contributions will be licensed under its MIT license.

Built Using #

Flutterwave API References #

49
likes
0
pub points
98%
popularity

Publisher

unverified uploader

Flutterwave's official library that wraps the standard implementation.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, flutter_inappwebview, fluttertoast, http

More

Packages that depend on flutterwave_standard