Please, do not share your card details with anyone. Note that FIB never ask you for such information.
FIB payment SDK was created to allow you to integrate FIB as a convenient payment method within your application:
This section will show the probable flow of using the Mobiles-SDK for Initiating a transaction, retrieving transaction status and canceling a transaction.
Following are features of the iOS Payments SDK:
FIB Payment SDK is a payment library using First Iraqi Bank App written in Swift.
It is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrateFIBPaymentSDK into your Xcode project using CocoaPods, specify it in your Podfile
FIBPaymentSDK
Podfile
Code Example
pod 'FIBPaymentSDK', '~> 1.1.1'
If you want to integrate the SDK using Swift Package Manager you just need to go toFile -> Swift Packages -> Add Package Dependency... then in the search writehttps://github.com/First-Iraqi-Bank/fib-ios-sdk.git , the url for this github repository, then choose the version or the branch of interest.
File -> Swift Packages -> Add Package Dependency...
https://github.com/First-Iraqi-Bank/fib-ios-sdk.git
The first thing you will need to do if you want to use this SDK is having a property list file in your app with exactly this name:FIBConfiguration.plist This file contains the required data for the SDK to be able to work. Replace the content of the SDK with:
FIBConfiguration.plist
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>accountId</key> <string>you will be given this ID</string> <key>clientSecret</key> <string>you will be given this secret</string> <key>clientId</key> <string>you will be given this ID</string> <key>grantType</key> <string>client_credentials</string> <key>baseURLs</key> <dict> <key>fibPayGate</key> <string>this URL with change based on your need</string> </dict> </dict> </plist>
1.accountId : this isaccountId of the FIB business account which receives the payments.
accountId
2. clientSecret: an secret that you will be given to authenticate you.
clientSecret
3.clientId : an Id that you will be given to identify you as a client.
clientId
4.grantType : This is used for authentication as well.
grantType
5.baseURLs : thebaseURLs that we use for making the API requests for creating the payment, currently it only has one property which isfibPayGate .
baseURLs
fibPayGate
1.Develop : which can be used for testing purposes.
Develop
https://fib.stage.fib.iq
2.production : which you will use when you release your app.
production
https://fib.prod.fib.iq
To use theFIBPaymentSDK you need to import:
import FIBPaymentSDK
Then you will need to create an instance ofPayWithFIBView :
PayWithFIBView
let fibView = PayWithFIBView()
PayWithFIBView has three methods:
1.Configure : which you can call to make the view intractable.
Configure
configure(fibApplicationURLs: [FIBApplicationURLType], delegate: FIBPaymentManagerDelegate?)
Configure has two parameters:
a.fibApplicationURLs : this is an Array of TypeFIBApplicationURLType ,so we expect all the links of the FIB apps to be sent to this method;
fibApplicationURLs
FIBApplicationURLType
b.delegate : it is an instance of typeFIBPaymentManagerDelegate? which you need conform in order to be notified about some additional information on the transaction.
delegate
FIBPaymentManagerDelegate?
FIBPaymentManagerDelegate has two methods which you can implement:
FIBPaymentManagerDelegate
I.paymentCanceled : this one is called when you cancel a specific payment.
paymentCanceled
func paymentCanceled(paymentID: String):
II.didReceive : This one will be called every time you want to start a FIB payment or check the status of a specific payment but an error occurs in the APIRequest for handling these cases you will need to implement this to deal with anyerror that might happen.
didReceive
error
func didReceive(error: APIError):
The error is of typeAPIError which is anenum So that you can check what exactly is the error and update you UI accordingly. Doing so you enable thefibView to make all the required functionalities and present and alert to indicate to the user that he/she can open the available FIB applications.
APIError
enum
fibView
2.checkPaymentStatus : It is another method ofPayWithFIBView will be used to check the status of a specific payment.
checkPaymentStatus
public func checkPaymentStatus(paymentID: String, completion: @escaping (PaymentStatusType?) -> Void)
checkPaymentStatus has two parameters:
a.paymentID : an ID which is used to indicate which transaction you need to check;
paymentID
b.completion : which gives you feedback about the status.
completion
3.cancelPayment : It is another method ofPayWithFIBView will be used to cancel a specific payment.
cancelPayment
func cancelPayment(paymentID: String)
Note: Please note that Cancel Payment feature should not be used for refunding an item, this feature should be used only to cancel a pending and currently active payment.
PayWithFIBView has an instance of UI Button which you can customize for example like that:
fibView.button.setTitle( "any custom title", for: .normal)
You can assign the logic for handling payment with FIB your self, If you want to use the SDK but you want to use your won UI, we got your back.We have created a class which you can use to handle all the logic but provide your own UI:
let fibPaymentManager: FIBPaymentManagerType init(fibPaymentManager: FIBPaymentManagerType = FIBPaymentManager()) { self.fibPaymentManager = fibPaymentManager fibPaymentManager.delegate = self }
As you seeFIBPaymentManagerType is a protocol andFIBPaymentManager is the class that conforms to it, we have provided this protocol in order to make your life easier in terms of testability.
FIBPaymentManagerType
FIBPaymentManager
1.openFIB : This is responsible for opening the fib apps based on you input:
openFIB
func openFIB(_ applicationType: FIBApplicationURLType)
It has one parameter which isapplicationType : you can pass.personalURL("personal app link") or.businessURL("business app link") or.corporateURL("corporate app link") , based on user’s input to you.
applicationType
.personalURL("personal app link")
.businessURL("business app link")
.corporateURL("corporate app link")
2.checkPaymentStatus : This one is used to check the status of a specific payment.
func checkPaymentStatus(paymentID: String, completion: @escaping ((PaymentStatusType?) -> Void))
It has two parameters:
a.paymentID : an ID which is used to indicate which transaction you need to check; b.completion : which gives you feedback about the status.
3.cancelPayment : you call this one when you want to cancel a specific payment.
As you can see in the body of theinitializer ,fibPaymentManager has a property calleddelegate and it is of typeFIBPaymentManagerDelegate? Which you need to conform to and implement its methods.
initializer
fibPaymentManager
FIB-Payment-SDK is released under the MIT license. See License for details.
This SDK also includes an option to redirect the user from the FIB applications to your application, you can provide the applicationsredirect URI and everything will be handled for you.
redirect URI
It is optional to have this feature, so if you provide yoursredirect URI , the redirection happens otherwise the FIB applications behave as they normally would.
Thank you! We will get back to you shortly.
This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.