Skip to content

theresasogunle/Rave-Java-Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

94 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Coverage Status Maintainability Scrutinizer Code Quality

Flutterwave Rave (Rave-Java-Library)

Rave-Java-Library facilitates quick and easy development and integration of Java based applications with the Flutterwave API.

  • Contributors: Theresa Sogunle, Oluwole Adebiyi (KingFlamez)
  • Tags: rave, flutterwave, payment gateway, bank account, credit card, debit card, nigeria, kenya, ghana, international, mastercard, visa, KES, GHC, NGN, Java.

Getting Started

Prerequisite

Signup for a test account here

Signup for a live account here

Installation (Jar file)

Maven

<dependency>
  <groupId>com.github.theresasogunle</groupId>
  <artifactId>Rave</artifactId>
  <version>1.0.1</version>
  <type>jar</type>
</dependency>

Visit Bintray

Jar

  • Download latest Rave-Java-Library jar file from here

How to Install Jar Libraries

On Netbeans IDE: Project properties -> Libraries -> Compile -> ADD JAR/folder -> Add Jar

On Intelli J IDEA: File > Project Structure -> Project Settings > Modules > Dependencies > "+" sign > JARs or directories

  • Set to go πŸ’ͺ

Sample Use

  • Simple Card Charge
import com.rave.*;
import org.json.JSONObject;


public class Main {

    public static void main(String[] args) throws Exception  {

        RaveConstant.PUBLIC_KEY="FLWPUBK-8ba286388b24dbd6c20706def0b4ea23-X";
        RaveConstant.SECRET_KEY="FLWSECK-c45e0f704619e673263844e584bba013-X";
        RaveConstant.ENVIRONMENT=Environment.STAGING; //or live


        CardCharge ch = new CardCharge();

        ch.setCardno("4187427415564246")
                .setCvv("828")
                .setAmount("3000")
                .setExpiryyear("19")
                .setExpirymonth("09")
                .setEmail("[email protected]")
                .setTxRef("MXX-ASC-4578")
                .setSuggested_auth("PIN")
                .setPin("3310");

        JSONObject charge= ch.chargeMasterAndVerveCard();

        System.out.println(charge);
    }
}
  • Rave Card Charge
import com.rave.*;
import org.json.JSONObject;

public class Main {

    public static void main(String[] args)throws JSONException {
	//rave constants
        RaveConstant.PUBLIC_KEY="FLWPUBK-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-X";
        RaveConstant.SECRET_KEY="FLWSECK-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-X";
        RaveConstant.ENVIRONMENT=Environment.STAGING; //or live

	CardCharge ch=new CardCharge();
        ch.setCardno("4187427415564246")
          .setCvv("828")
          .setCurrency("NGN")
          .setCountry("NG")
          .setAmount("9000")
          .setExpiryyear("19")
          .setExpirymonth("09")
          .setEmail("[email protected]")
          .setIP("103.238.105.185")
          .setTxRef("MXX-ASC-4578")
          .setDevice_fingerprint("69e6b7f0sb72037aa8428b70fbe03986c");
     
         //for master card and verve
     
           ch.setPin("3310")
             .setSuggested_auth("PIN");
             JSONObject charge= ch.chargeMasterAndVerveCard();
            //if timeout
            JSONObject poll=ch.chargeMasterAndVerveCard(true);
   
       
       //for visa and intl cards
        ch.setRedirect_url("http://www.google.com");
        JSONObject chargevisa=ch.chargeVisaAndIntl();
	  //if timeout, poll
            JSONObject pollvisa=ch.chargeVisaAndIntl(true);
       
    }
}
  • Rave Account Charge
import com.rave.AccountCharge;
import com.rave.Encryption;
import org.json.JSONObject;

public class Main {

    public static void main(String[] args) throws JSONException{
      	   //rave constants
        RaveConstant.PUBLIC_KEY="FLWPUBK-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-X";
        RaveConstant.SECRET_KEY="FLWSECK-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-X";
        RaveConstant.ENVIRONMENT=Environment.STAGING; //or live

	  
            AccountCharge ch= new AccountCharge();
            
          ch.setAccountnumber("0690000031")
            .setAccountbank("044")
            .setAmount("1000")
            .setCountry("NG")
            .setCurrency("NGN")
            .setLastname("Theresa")
            .setIP("1.3.4.4")
            .setPayment_type("account")
            .setTxRef("MX-678DH")
            .setEmail("[email protected]");
          
         JSONObject result=ch.chargeAccount();
          //polling
            JSONObject poll=ch.chargeAccount(true);
        System.out.println(result);
        //Validate The Charge
         //do not forget to set your fields
        ch.setTransaction_reference("ACHG-1520028650995")
          .setOtp("12345");
        //for polling
        JSONObject val=ch.validateAccountCharge(true);
        //without polling
        JSONObject validate=ch.validateAccountCharge());
    }
}

Test Implementation

Classes and Methods

The documentation for each classes and methods

  1. AccountCharge
  2. AlternatePayment
  3. Bank
  4. CardCharge
  5. Encryption
  6. ExchangeRates
  7. Fees
  8. PreAuthorization
  9. Refund
  10. Transaction
  11. IntegrityChecksum

Todo

  • Recurring Payments

License

The MIT License (MIT). Please see License File for more information.