The MIPS Payment SDK is designed to facilitate seamless payment processing within your iOS applications. Written in Swift, it supports integration with both Swift and Objective-C projects. This guide will walk you through the steps to integrate the SDK into your app.
Before you begin, ensure you have the following credentials provided by MIPS Admin:
sIdMerchant
id_entity
id_operator
operator_password
username
password
To integrate the SDK using CocoaPods, add the following line to your Podfile:
pod 'MipsPaymentSdk', :git => 'https://github.com/MIPSIT-DIGITAL/ios-sdk'
After updating your Podfile, run the following command in your terminal:
pod install
This will install the MIPS Payment SDK into your project.
In the files where you intend to use the SDK, import it as follows:
import MipsPaymentSdk
Create instances of MerchantDetails and MerchantCredentials with the credentials provided:
let merchantDetails = MerchantDetails(
sIdMerchant: "YOUR_MERCHANT_ID",
id_entity: "YOUR_ID_ENTITY",
id_operator: "YOUR_ID_OPERATOR",
operator_password: "YOUR_OPERATOR_PASSWORD"
)
let credentials = MerchantCredentials(
username: "YOUR_USERNAME",
password: "YOUR_PASSWORD"
)
Define the order ID and amount for the transaction:
let orderID = "YOUR_ORDER_ID"
let amount = Amount(currency: .Mauritian_Rupee, price: 100)
Create an instance of MIPSViewController with the necessary details:
let paymentPage = MIPSViewController(
merchantDetails: merchantDetails,
credentials: credentials,
amount: amount,
orderID: orderID
)
To handle payment status updates, ensure your class conforms to the **MipsPaymentPageDelegate** protocol and set the delegate:
paymentPage.delegate = self
Display the payment page and initiate the payment process:
self.present(paymentPage, animated: true) {
paymentPage.createPayment()
}
Implement the successPayment method from the MipsPaymentPageDelegate protocol to handle successful payments:
extension YourViewController: MipsPaymentPageDelegate {
func successPayment(_ sender: MIPSViewController, orderID: String, mode: PaymentMode) {
DispatchQueue.main.async {
sender.dismiss(animated: true) {
// Handle post-payment success actions here
}
}
}
}
By following these steps, you can seamlessly integrate the MIPS Payment SDK into your iOS application, providing a secure and efficient payment experience for your users.
For more details and updates, refer to the MIPS iOS SDK GitHub repository
---
Hi! I'm Shyank, a full-stack Software developer and a call-of-duty enthusiast, I help businesses grow their company with the the help of technology, improve their work, save time, and serve their customers well, I have worked with many global startups and Govt bodies to develop some of the most secure and scaled apps