Foloosi
Search…
iOS SDK
The Foloosi Payments plugin allows you to accept credit card and debit card payments via Foloosi payment gateway.

Foloosi iOS SDK Integration

Step - 1 - Add Dependency

1
pod 'Foloosi-iOS-SDK', '~> 1.3.1'
2
pod update
Copied!

Step - 2 - Import SDK

1
import FoloosiSdk
Copied!

Step - 3 - Initialize SDK

To initialize the SDK add the below line of code with the merchant key you retrieved from foloosi merchant panel. If you don't have a merchant key create new one.
1
FoloosiPay.initSDK("Your Unique Merchant Key",withDelegate: Self)
Copied!

Step - 4 - Create Order Data Object with necessary inputs

You can create the order data or payment input with our OrderData Model class. Here you need to provide order id, title, descripiton, currency code, order amount and customer details like name, email, mobile number.
1
let orderData = OrderData()
2
orderData.orderTitle = "" // Any Title
3
orderData.currencyCode = "" // 3 digit currency code like "AED"
4
orderData.customColor = "#12233" // make payment page loading color as app color.
5
orderData.orderAmount = 0 // in double format ##,###.##
6
orderData.orderId = "" // unique order id.
7
orderData.orderDescription = "" // any description.
8
let customer = Customer()
9
customer.customerEmail = "[email protected]"
10
customer.customerName = "name"
11
customer.customerPhoneNumber = "1234567890"
12
orderData.customer = customer
Copied!

Step - 5 - Make Transaction with Foloosi

Use the below line of code to make the payment with the order data you created in Step - 4
1
FoloosiPay.makePayment(orderData: orderData)
Copied!

Step - 6 - Implement Payment Delegate

Implement our payment delegate to receive the payment result for the payment we made in Step - 5. Use the below code to obtain the payment result.
1
extension ViewController: FoloosiDelegate{
2
func onPaymentError(descriptionOfError: String) {
3
// Failure Callback.
4
}
5
6
func onPaymentSuccess(paymentId: String) {
7
// Success Callback
8
}
9
}
Copied!

iOS 9 Update

iOS 9 has higher requirements for secure URLs. As many Indian banks do not comply with the requirements, you can implement the following as a workaround in Info.plist
1
<key>NSAppTransportSecurity</key>
2
<dict>
3
<key>NSAllowsArbitraryLoads</key>
4
<true/>
5
</dict>
Copied!

Foloosi Log

You can enable / disable the SDK logs by using the below line of code. By default it will be enabled.
1
FLog.setLogVisible(debug: true or false)
Copied!

Sample Payment Reference.

Please check this link for sample payment with above steps.
Last modified 30d ago