Skip to content

NUMO BUTTON ANDROID SDK

The purpose of this SDK is to help developers to implement the NUMO Android button payment SDK

To use this SDK, you need a Merchant id ,Terminal id and Secure key.

GETTING STARTED

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

**You can use test data for testing

PREREQUISITES

What things you need to install the software and how to install them

  1. JDK installed on your machine with minimum version 1.7 .
  2. Android Studio.
  3. Create new Android project in Android Studio to 4. use SDK or if you have created a project before with minSdkVersion api version 19.
  4. AndroidX compatibility.

INSTALLATION

A step by step that tell you how to get our SDK in your project.

  1. Open your android project.
  2. Add the below to repositories{} inside allproject{} in your project level build.gradle file
ts
maven { url 'https://jitpack.io' }

Example

ts

    allprojects { repositories {
            maven { url 'https://jitpack.io' }
                    }
                }
  1. in your build.gradle file in app level in dependencies add:
ts
 implementation 'com.github.payskyCompany:NUMO-PayButton-SDK-
    android:1.0.7'

Example

ts
  dependencies {
        implementation 'com.github.payskyCompany:NUMO-PayButton-SDK-
            android:1.0.7'
                }

Note: make sure to use the latest version of our SDK by checking the GitHub repo.

  1. Sync your project

USING THE SDK

Please note that In order to use the SDK you need to get a Merchant ID a Terminal ID from MOAMALAT FINANCIAL SERVICES

  1. Create a new instance from PayButton:
ts
  PayButton payButton = new PayButton(context);

You need to pass the following parameters to the PayButton class instance:

  • Merchat id.
  • Terminal id.
  • Payment amount.
  • Currency code [Optional].
  • Merchant secure hash.
  • Transaction Reference Number.

And please note that you should keep your secure hash ,merchant ID and Terminal ID encrypted before saving them in storage .

Example

ts
    payButton.setMerchantId("XXXXXXXX");
        // your merchant id 
    payButton.setTerminalId("XXXXXXXXXXX"); 
        // your terminal id 
    payButton.setAmount(0);
        // the payment amount 
    payButton.setCurrencyCode(434);
        // use 434 for the Libyan currency [Optional]
    payButton.setMerchantSecureHash("");
        // Merchant secure hash 
    payButton.setTransactionReferenceNumber("");
        // unique transaction reference number.
    payButton.setProductionStatus(STAGINIG);
        // "Use AllURLsStatus.STAGINIG for test environment, 
        //AllURLsStatus.PRODUCTION for production"
    payButton.setLang("localLang");

Reference number can be generated from AppUtils.generateRandomNumber(); example:

ts
payButton.setTransactionReferenceNumber(AppUtils.generateRandomNumber());
  1. In order to create a transaction you just call create Transaction method and pass to it
  • onCardTransactionSuccess method this method called in case transaction success by card payment with SuccessfulCardTransaction object SuccessfulCardTransaction object from create transaction listener contains:-
  • NetworkReference variable that is reference number of transaction.
  • AuthCode variable.
  • ActionCode variable.
  • ReceiptNumber variable.
  • Amount variable.
  • onWalletTransactionSuccess method this method is called if customer make a wallet transaction with SuccessfulWalletTransaction object.

  • SuccessfulWalletTransaction object from create transaction listener contains:-

  • NetworkReference variable that is reference number of transaction.
  • Amount variable.
  • onError method will be called with throwable exception that has the error details In case the transaction fails.
ts
payButton.createTransaction(new
    PayButton.PaymentTransactionCallback() {
        @Override
        public void onCardTransactionSuccess
            (SuccessfulCardTransaction cardTransaction) {
                Toast.makeText(MainActivity.this,
                                cardTransaction.toString(),
                                Toast. LENGTH_LONG)
                                .show();
            }
        @Override
        public void onWalletTransactionSuccess
            (SuccessfulWalletTransaction walletTransaction) {
                Toast.makeText(MainActivity.this,
                            walletTransaction.toString(),
                            Toast.LENGTH_LONG)
                            .show();
            }
        @Override
        public void onError(TransactionException error) {
            Toast.makeText(MainActivity.this,
                            error.toString(),
                            Toast.LENGTH_LON G)
                            .show();
            });

SAMPLE PROJECT

To get a sample project CLICK HERE