this is the official SDK of MIPS payment gateway for iOS platform
pod "MIPS_iOS_SDK"
- sIdMerchant
- sIdForm
- salt
- sCipherKey
- id_entity
- id_operator
- operator_password
- username
- password
- import MIPS_iOS_SDK
import MIPS_iOS_SDK
- create mips network model
let networkUrls : MipsNetworkUrls = .defaultUrls
- create merchant detail model
let merchantDetails : MerchantDetails = .init(
sIdMerchant: "YOUR_MERCHANT_ID",
sIdForm: "YOUR_ID_FORM",
salt: "YOUR_SALT",
sCipherKey: "YOUR_CIPHER_KEY",
id_entity: "YOUR_ID_ENTITY",
id_operator: "YOUR_ID_OPERATOR",
operator_password: "YOUR_OPERATOR_PASSWORD"
)
- create merchant credential model
let credential : MerchantCredentials = .init(
username: "YOUR_USERNAME" ,
password: "YOUR_PASSWORD"
)
- take order ID and order amount
let orderID : String = "YOUR_ORDER_ID"
let amount : Amount = .init(currency: .Mauritian_Rupee, price: 100)
- Create payment page screen
let paymentPage : MIPSViewController = .init(
networkURL: networkUrls,
merchantDetails: merchantDetails,
credentials: credential,
amount: amount,
orderID: orderID
)
// to track payment status conform to MipsPaymentPageDelegate protocol and make your class delegate to paymet page
paymentPage.delegate = self
- Show payment page and start payment transaction
self.present(
paymentPage,
animated: true
) {
paymentPage.createPayment()
}
- track payment success callback
// conform your class to MipsPaymentPageDelegate and set it as delegate of payment page
class ViewController: UIViewController, MipsPaymentPageDelegate {
func successPayment(
_ sender: MIPS_iOS_SDK.MIPSViewController,
orderID: String,
mode: MIPS_iOS_SDK.PaymentMode
){
// payment is completed,
DispatchQueue.main.async { // switch to main thread for ui operation
sender.dismiss(animated: true) { // remove payment page,
// handle the flow as payment is completed and
// payment page is removed now
}
}
}
}