Welcome to Paymob Accept Documentation

Learn the fastest way to Integrate Accept into your products and start collecting payments in 5 minutes. We provide you with all the resources you'll need including API references, documentation, SDKs, and technical guides.

Get Started

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 = ""

// Place your billing data here
// billing data can not be empty
// if empty, type in NA instead
let bData = [  "apartment": "",
               "email": "",
               "floor": "",
               "first_name": "",
               "street": "",
               "building": "",
               "phone_number": "",
               "shipping_method": "",
               "postal_code": "",
               "city": "",
               "country": "",
               "last_name": "",
               "state": ""
]

now call the function

do {
           try accept.presentPayVC(vC: self, billingData: bData, 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, billingData: bData, 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,
                                    billingData: bData,
                                    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 2 months ago


IOS SDK


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.