Hello guys, today we learn about how to implement Moamalat Payment Integration via SDK.
In-Ecommerce Applications, according to user requirements we need to implement the payment method in the app.
Here we have two methods
- Via WebView
- Via SDK
Here, we implement the Moamalat Payment Integration via SDK, Let’s start the implementation
Getting Start
Step 1: – Firstly, Create Xcode Project
File –> New –> Project –> iOS –> Next And Add your project name and then create
Step 2:- Secondly, Install the pod for moamalat payment
how to install pod in XCode project
- open terminal
- open your project path
- write pod init
- open the pod file and add “pod ‘PayButtonNumo’“
- And pod install
- Now, open xcode.xcworkspace project
step 3:- Lastly, code implementation
Here, you need to pass some required details in SDK controller like
- payment amount
- your SDK merchant id
- your terminal id
- currency code – it should be an integer value
- your payment secure hash key
- And, app status – like it is in production mode or testing mode
firstly call the payment delegate method into your class
1 2 |
class ViewController: UIViewController, PaymentDelegate { } |
And create a variable for the payment view controller
1 |
let paymentViewController = PaymentViewController() |
Add the payment SDK code where you want to perform the payment action
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
self.paymentViewController.amount = //Enter payment amount ex."6805" // Formatted amount as smallest amount of currency ex: 1 LYD = “1.000” self.paymentViewController.delegate = self // PaymentDelegate self.paymentViewController.mId = // your merchant id self.paymentViewController.tId = // your terminal id self.paymentViewController.Currency = "434" // use 434 for the Libyan currency self.paymentViewController.refnumber = // unique transaction reference number. self.paymentViewController.Key = // Merchant secure hash self.paymentViewController.AppStatus = NumoUrlTypes.Numo_Testing or NumoUrlTypes.Numo_Production self.paymentViewController.pushViewController() |
After completing the payment process you get success and fail results for this you need to call, the finishSdkPaymentfunction into your class And add the code for the payment result
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
func finishSdkPayment(_ transactionStatusResponse: TransactionStatusResponse, cardHolderName: String, cardNumber: String) { if transactionStatusResponse.Success // will be true if transaction success { print("success",transactionStatusResponse) }else{ print("fail",transactionStatusResponse) } } |
Now, run the project and check the output.
when you click the Payment button you get the details screen
Enter all the card details and proceed, you need to add OTP
After verifying the OTP you get success and fail screen and click to close button it will redirect you to your controller class where you add the transactionStatusResponse function working
Conclusion:-
In, this blog we discussed the working of Moamalate payment integration via SDK
I hope this blog will help you to implement the payment SDK for a sample project click here
Thanks for reading!!