GithubHelp home page GithubHelp logo

cscoderr / flutter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from asapj/flutter_standard

0.0 1.0 0.0 95 KB

Flutter library for Flutterwave for Business (F4B) v3 APIs.

Home Page: https://developer.flutterwave.com/

License: MIT License

Ruby 3.60% Objective-C 0.10% Kotlin 0.33% Dart 94.90% Swift 1.07%

flutter's Introduction

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
  2. Installation
  3. Usage
  4. Support
  5. Contribution guidelines
  6. License

Requirements

  1. Flutterwave for business API Keys
  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.2
  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
  • currency
  • email
  • fullName
  • txRef
  • isDebug
  • paymentOptions
  • 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: "[email protected]"
	    );  
	    
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
	    ); 
	} 

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

Note

  1. ChargeResponse can be null if a user cancels the transaction by pressing back.
  2. You need to confirm the transaction is succesful. Ensure that the txRef, amount, and status are correct and successful. Be sure to verify the transaction details before providing value.

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.

Copyright (c) Flutterwave Inc.

Built Using

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.