Hey, In this blog we will know to implement the Ipay88 payment gateway in swift
Please read the blog and this blog will help you with Ipay88 payment gateway in swift.
- You need to download the Ipay88 sdk from here
- You need to add this file to your project please check here
- Then import this sdk to your project and after added you can see here in yorur project
4. Then move to implementation of the payment gateway.
once you added the SDK to your project please add the below code in your header file
this will help to use the SDK from the view controller.
1 2 |
#import "Ipay.h" #import "IpayPayment.h" |
then move the view controller where you want to implement
5. Define the below variable in your controller.
1 2 |
var paymentSDK : Ipay? var requeryPayment:IpayPayment? |
6. Then send the detailed data to the payment gateway please check below
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
requeryPayment = IpayPayment(); requeryPayment?.paymentId = "" requeryPayment?.merchantKey = "" requeryPayment?.merchantCode = "" requeryPayment?.refNo = "" requeryPayment?.amount = "" requeryPayment?.currency = "" requeryPayment?.prodDesc = "" requeryPayment?.userName = "" requeryPayment?.userEmail = "" requeryPayment?.userContact = "" requeryPayment?.remark = "" requeryPayment?.lang = "" requeryPayment?.country = "" requeryPayment?.backendPostURL = "" |
7 Then you have to initialise the sdk
1 2 3 4 5 6 |
paymentSDK = Ipay(); paymentSDK?.delegate = self; paymentView = paymentSDK?.checkout(requeryPayment) self.view.addSubview(paymentView!); |
8. In the delegate method you can get the status of the payment gateway
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
extension ViewController : PaymentResultDelegate { func paymentSuccess(_ refNo: String!, withTransId transId: String!, withAmount amount: String!, withRemark remark: String!, withAuthCode authCode: String!) { print("Success") } func paymentFailed(_ refNo: String!, withTransId transId: String!, withAmount amount: String!, withRemark remark: String!, withErrDesc errDesc: String!) { print("Failed") } func paymentCancelled(_ refNo: String!, withTransId transId: String!, withAmount amount: String!, withRemark remark: String!, withErrDesc errDesc: String!) { print("Cancel") } func requerySuccess(_ refNo: String!, withMerchantCode merchantCode: String!, withAmount amount: String!, withResult result: String!) { print("something") } func requeryFailed(_ refNo: String!, withMerchantCode merchantCode: String!, withAmount amount: String!, withErrDesc errDesc: String!) { print("something") } } |
9. At the end please handle the status of the payment
I hope this blog will help you to understand this integration, if you have any queries, comments, questions, or recommendations, feel free to post them in the comment section below!