IOS SDK
Installation:
AcceptCardSDK is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod 'AcceptCardSDK'
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 AcceptSDK
import AcceptSDK
add the delegate to the class, and add the protocol stubs
class ViewController: UIViewController, AcceptSDKDelegate {
//.....
}
then create a constant
let accept = AcceptSDK()
then pass self to delegate
accept.delegate = self
then create the variables
// place your payment key here
let KEY: String = ""
Payment Key
A valid payment key is required to start the payment.
Valid means Fresh(newly created), doesn't have pending transactions, the best to do is to create a new order for every payment key. To generate a payment key, check this link here.
now call the function
do {
try accept.presentPayVC(vC: self, paymentKey: KEY, saveCardDefault:
true, showSaveCard: true, showAlerts: true)
} catch AcceptSDKError.MissingArgumentError(let errorMessage) {
print(errorMessage)
} catch let error {
print(error.localizedDescription)
}
and if you already have a saved token
do {
try accept.presentPayVC(vC: self, paymentKey: KEY, saveCardDefault: false, showSaveCard: false, showAlerts: true, token: "", maskedPanNumber: "xxxx-xxxx-xxxx-1234")
} catch AcceptSDKError.MissingArgumentError(let errorMessage) {
print(errorMessage)
} catch let error {
print(error.localizedDescription)
}
what the parameters do
//Show the user whether or not he wants to save the card
showSaveCard: true
//Initially, the save card option is on or off
saveCardDefault: true
//either show the user some alerts on success / failure or not
showAlerts: true
you can use extra parameters such as
//for the color of the buttons
buttonsColor: UIColor.blue
//for english langauge
isEnglish: false
//for arabic language
isEnglish: false
//for the color od the Background
backgroundColor: UIColor.white
//for the color of the Navigation Bar
navBarColor: UIColor.white
/for the folor of the text in the Navigation Bar
navBarTextColor: UIColor.black
//for the color of the background of the TextFields
textFieldBackgroundColor: UIColor.gray
//for the color of the texts inside the textfields
textFieldTextColor: UIColor.black
//for the color main title of the page ("Card Information")
titleLabelTextColor: UIColor.darkGray
//for the color of the labels
inputLabelTextColor: UIColor.darkGray
//to change the pay button text
buttonText: ""
//to change the card Name text
cardNameLabelText: ""
//to change the card number text
cardNumberLabelText: ""
//to change the expiration text
expirationLabelText: ""
//to change the cvv text
cvvLabelText: ""
//used like this
do {
try accept.presentPayVC(vC: self,
paymentKey: KEY,
saveCardDefault: true,
showSaveCard: true,
showAlerts: true,
buttonsColor: UIColor.black,
isEnglish: true,
backgroundColor: UIColor.white,
navBarColor: UIColor.white,
navBarTextColor: UIColor.black,
textFieldBackgroundColor: UIColor.white,
textFieldTextColor: UIColor.black,
titleLabelTextColor: UIColor.black,
inputLabelTextColor: UIColor.black,
buttonText: "",
cardNameLabelText: "",
cardNumberLabelText: "",
expirationLabelText: "",
cvvLabelText: "")
} catch AcceptSDKError.MissingArgumentError(let errorMessage) {
print(errorMessage)
} catch let error {
print(error.localizedDescription)
}
Updated about 1 year ago