Updated 27 August 2021
In this blog, we are going to learn about the BillDesk Payment gateway in Swift. Payment gateway is an essential part of any mobile application for sales and purchase of services or products. BillDesk is an Indian online payment gateway in the region of Maharashtra and Madhya Pradesh.
Thereafter, please follow the below steps are the integration of the BillDesk Payment gateway in Swift.
Please create your account on the BillDesk Payment gateway from here.
Now drag and drop the BilldeskLiberary into your project from the demo BillDesk project.
In addition, make use of libBilldesk_device if you are running on your device and libBilldesk_simulator if you are running your app on your simulator.
Now copy the drag and drop the controller folder from the sample project to your swift project.
After that, we will create an instance of the BDFirstViewController and pass the required information for the payment gateway.
1 2 3 4 5 6 |
let viewController: BDFirstViewController = segue.destination as UIViewController as! BDFirstViewController viewController.amount = "\(orderReviewViewModel.orderTotalAmount.last?.value ?? "")" viewController.email = orderReviewViewModel.billdesk?.email ?? "" viewController.messgae = orderReviewViewModel.billdesk?.msg ?? "" viewController.returnUrl = orderReviewViewModel.billdesk?.returnUrl ?? "" viewController.telephone = orderReviewViewModel.billdesk?.telephone ?? "" |
For instance the transaction result, we will show an alert and navigate the controller to success and failure controller.
1 2 3 4 5 6 7 8 |
func showAlert(_ message: String) { let alertController = UIAlertController(title: "Payment status", message: message, preferredStyle: .alert) alertController.addAction(UIAlertAction(title: "Ok", style: .cancel) { (action:UIAlertAction!) in self.callingApi() }) self.present(alertController, animated: true, completion: nil) } |
We have successfully integrated the bill desk payment gateway in swift. Thanks for reading my blog. Please refer to my other blog from here.
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.