Git Product home page Git Product logo

thepeer-android's Introduction

Thepeer official Android SDK

CI

Thepeer Android SDK gives one integration access to all fintech businesses on your Android App

  1. Send
  2. Checkout
  3. Direct Charge

Demo

Send.money.mov
Direct.charge.mov
Checkout.mov

Setup Implementation

Step 1: Add Dependency

To your root build.gradle file add:

allprojects {
    repositories {
        mavenCentral() 
    }
}

To your app-level build.gradle file add:

dependencies {
    // ...
    implementation "co.thepeer:thepeer-android:[version]"
}

Step 2: Add Public Key to Manifest

 <meta-data
    android:name="co.thepeer.PublicKey"
            android:value="YOUR_PUBLC_KEY" />

Step 3: Initialization

KOTLIN

//initialize Thepeer SDK
override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
     

        //initialize Thepeer SDK
        val thepeer = Thepeer.Builder(
            activity = this,
            amount = BigDecimal(10000.00),
            currency = "NGN",
            userReference = getString(R.string.user_reference),
            resultListener = resultListener
        ).setMeta(mapOf("remark" to "Enjoy")).build()
        
        }

JAVA

//initialize Thepeer SDK
   @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //initialize Thepeer SDK
        Thepeer thepeer =new Thepeer.Builder(
                this,
                new BigDecimal("1000.00"),
                "NGN",
                getResources().getString(R.string.user_reference),
                new ThepeerResultListener())
                
                }
Parameter name Description Required
amount The amount you intend to send and must be pass as an integer in kobo true
currency Currency which can be "NGN" or "USD" true
userReference The user reference returned by Thepeer API when a user has been indexed true
meta This object should contain additional/optional attributes you would like to have on your transaction response false

Send

Initiate the send request by calling the below function

KOTLIN

thepeer.send()

JAVA

thepeer.send();

Checkout

Initiate the checkout request by calling the below function

KOTLIN

thepeer.checkout(email: String)

JAVA

thepeer.checkout(String email);

Direct Charge

Initiate the Direct Charge request by calling the below function

KOTLIN

thepeer.directCharge()

JAVA

thepeer.directCharge();

Listener

Once the request is initiated the SDK will wait from response from the service and notify the App via ThepeerResultListener KOTLIN

private val resultListener = object : ThepeerResultListener {
    override fun onSuccess(transaction: ThepeerTransaction) {
        //Transaction Successful
        Log.v(TAG, transaction.toString())

    }

    override fun onError(error: Throwable) {
        //Transaction Error occured
        Log.e(TAG, error.message)
    }

    override fun onCancelled() {
        //Transaction was cancelled
        Log.e(TAG, " Cancelled")
    }

}

JAVA

 new ThepeerResultListener() {

                    @Override
                    public void onSuccess(@NonNull ThepeerTransaction transaction) {
                        ((TextView) findViewById(R.id.resultText)).setText(transaction.toString());
                    }

                    @Override
                    public void onCancelled() {

                    }

                    @Override
                    public void onError(@NonNull Throwable error) {

                    }

                }

Support

If you're having trouble with Thepeer React or your integration, please reach out to us at [email protected]. We're more than happy to help you out.

Thepeer API References

thepeer-android's People

Contributors

nsikaktopdown avatar kamsy avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar

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.