Updated 31 January 2024
In this blog, we are going to learn about Paybutton Payment Gateway In Android. We are following the SDK approach with the latest SDK available on the Paybutton console.
Before starting integration first, we need to know what a payment gateway is.
A payment gateway is a merchant service provided by an e-commerce application service provider. Which authorizes card or direct payment processing.
For the integration of the payment gateway, we will follow the mentioned steps:
In this blog, we are using PayButton SDK and its inbuild UI for processing the payment gateway.
You can use any of the components as per your usage, mentioned on the Git Link.
1 |
implementation 'com.github.payskyCompany:NUMO-PayButton-SDK-android:1.0.8' |
Before creating the transactions, we will initialize the PayButton SDK for processing the payments. There are multiple steps for initializing the payment SDK.
We need to just pass some parameters to the PayButton class instance:-
1-Merchant id.
2-Terminal id.
3-Payment amount.
4-Currency code [Optional].
5-merchant secure hash.
6-transaction Reference Number.
We have added the dummy data, but you can add the data as per the data available on the PayButton Console.
After initializing the SDK, we can transact as per our needs.
1 2 3 4 5 6 7 8 |
val payButton = PayButton(mFragmentContext.requireContext()) payButton.setMerchantId("Your Merchant Id")// you will get it from the SDK console payButton.setTerminalId("Your Terminal Id")// you will get it from the SDK console payButton.setAmount(Amount)// amount of the order payButton.setCurrencyCode(Currency Code)// currency code payButton.setMerchantSecureHash("Merchant Hash")// you will get it from the SDK console payButton.setTransactionReferenceNumber(Reference Number); payButton.setProductionStatus(AllURLsStatus.STAGINIG); // you can set mode as per the requirements |
Now, we will create transactions and perform payment processing from SDK.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
payButton.createTransaction(object : PaymentTransactionCallback { override fun onCardTransactionSuccess(cardTransaction: SuccessfulCardTransaction) { Log.e("TAG", "onCardTransactionSuccess: $cardTransaction") transaction = cardTransaction } override fun onWalletTransactionSuccess(walletTransaction: SuccessfulWalletTransaction) { Log.e("TAG", "onWalletTransactionSuccess: ${walletTransaction.toString()}") ToastHelper.showToast(mFragmentContext.requireContext(), walletTransaction.Message) } override fun onError(error: TransactionException) { Log.e("TAG", "onError: ${error.toString()}") ToastHelper.showToast(mFragmentContext.requireContext(), error.errorMessage) } }) |
Now, we will use the cardTransaction object for fetching the data regarding the payment response, after getting the successful result.
You can use the response from SDK for maintaining the status of payment on the Admin end. Or you can use it as per your need.
In this blog, you have learned about the Paybutton Payment Gateway In Android.
For more information regarding the Paybutton Payment Gateway follow the link.
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.