SDK

Initialize

  1. Add gradle dependency by adding the following code to the your Android App build.gradle

If want to download the plugin from Google Play, use this code

dependencies {
    implementation "io.nearpay:nearpay-sdk-store:2.1.59"
}

If you want to download the plugin inside your app

dependencies {
    implementation "io.nearpay:nearpay-sdk:2.1.59"
}

2.Create single instance of NearPay object with context wherever you need.

nearPay = new NearPay.Builder()
        .context(this)
        .authenticationData(auth)
        .environment(Environments.SANDBOX)
        .locale(Locale.getDefault())
        .networkConfiguration(NetworkConfiguration.SIM_PREFERRED)
        .uiPosition(UIPosition.CENTER_BOTTOM)
        .paymentText(new PaymentText("يرجى تمرير الطاقة", "please tap your card"))
        .loadingUi(true)
        .build();

While creating instance for the object , you need to pass the following:

Context

You need to pass the current context

AuthenticationData .

Login Methods

  1. Login with JWT

  1. Login with existing mobile number

  1. Login with existing email

  1. Let the user enter the mobile number or email to Login

Locale (Optional)

Locale allows you to select the language to be used.

Environment (Optional)

This will allow you to choose the environments so you need to choose sandbox and we will tell you when it needs to be changed.

UIPosition (Optional)

This will allow you to choose where to show the UI in your screen.

networkConfiguration (Optional)

This will allow you to choose if you wish to choose which network to be used(Sim, Wifi or default).

triangle-exclamation

SDK FLOW

Setup (optional)

Setup allows you to install the payment plugin and log in to our SDK .

circle-info

if this function is not used , it will be called automatically when you use any other function.

triangle-exclamation

Purchase

Please note the amount should be entered like this 100 which means 1.00 KES so 1455 will be 14.55 KES & max length is 12 digits include exponent ( 123456789012 ) which will result in 1,234,567,890.12

enableReceiptUi is Boolean so you can set it true or false.

Refund

pass the transactionReferenceRetrievalNumber of the transaction you want to refund

enableReceiptUi is Boolean so you can set it true or false.

Reconcile

To perform a reconciliation, Payment reconciliation is an accounting process that verifies account balances to ensure all sets of records are true, consistent, and up-to-date. Businesses can reconcile their accounts daily, weekly, or monthly.

enableReceiptUi is Boolean so you can set it true or false.

Reverse

To perform a Reverse Transaction , it should be within one minute

enableReceiptUi is Boolean so you can set it true or false.

Session

Session is used to allow your users to make one transaction while the session is open, once it is closed they are not allowed to make transaction till you create another session, you need to pass the session id that you are getting when creating a new session using our the dashboard.

Find Session Data here.

Converting receipt to image for printing

You can convert the receipt to an image so you can print it.

Logout

When the user logs out of your application - the user must be logged out of the NearPay SDK

Last updated