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
- JDK installed on your machine with minimum version 1.7 .
- Android Studio.
- Create new Android project in Android Studio to 4. use SDK or if you have created a project before with minSdkVersion api version 19.
- AndroidX compatibility.
INSTALLATION
A step by step that tell you how to get our SDK in your project.
- Open your android project.
- Add the below to
repositories{}
insideallproject{}
in your project level build.gradle file
maven { url 'https://jitpack.io' }
Example
allprojects { repositories {
maven { url 'https://jitpack.io' }
}
}
- in your build.gradle file in app level in dependencies add:
implementation 'com.github.payskyCompany:NUMO-PayButton-SDK-
android:1.0.7'
Example
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.
- 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
- Create a new instance from PayButton:
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
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:
payButton.setTransactionReferenceNumber(AppUtils.generateRandomNumber());
- 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.
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