IOS SDK
PaymobSDK
Requirements
Installation
PaymobSDK is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod 'Paymob'
And in the general settings of your project, under libraried and frameworks
change the library from "Do not embed" to "Embed and Sign"
Usage
import the framework
import PaymobSDK
add the delegate to the class, and add the protocol stubs
class ViewController: UIViewController, PaymobSDKDelegate {
then create a constant
let paymob = PaymobSDK()
then pass self to delegate
paymob.delegate = self
then create the variables
// Replace this string with your payment key
let client_secret = "" //Put Client Secret Here
let public_key = "" // Put Public Key Here
let savedCards = [] // Put Saved Cards Here
now call the function
do{
try paymob.presentPayVC(VC: self, PublicKey: public_key, ClientSecret: client_secret, SavedBankCards: savedCards)
} catch let error {
}
you can customize the UI of the SDK such as
// the extra UI Customization parameters are
//sets the title to be the image you want
appIcon
//sets the title to be the name you want
appName
//changes the color of the buttons throughout the SDK, the default is black
buttonBackgroundColor
//changes the color of the buttons Texts throughout the SDK, the default is white
buttonTextColor
//set save card checkbox initial value
saveCardDefault
//set whether or not should show save card checkbox
showSaveCard
//used like this
let paymob = PaymobSDK()
paymob.paymobSDKCustomization.appIcon = UIImage()
paymob.paymobSDKCustomization.appName = ""
paymob.paymobSDKCustomization.buttonBackgroundColor = UIColor.black
paymob.paymobSDKCustomization.buttonTextColor = UIColor.white
paymob.paymobSDKCustomization.showSaveCard = true
paymob.paymobSDKCustomization.saveCardDefault = false
try paymob.presentPayVC(VC: self, PublicKey: public_key, ClientSecret: client_secret, SavedBankCards: userCardsTest)
## Author
[email protected]
## License
Paymob is available under the MIT license. See the LICENSE file for more info.
Updated 7 months ago