PayTabs 4.3.3

PayTabs 4.3.3

Maintained by Mohamed Adly, Mohamed Adly.



 
Depends on:
BIObjCHelpers~> 0.4.3
AFNetworking~> 4.0.1
Mantle~> 2.1.0
Reachability~> 3.2
Lockbox~> 3.0.6
SBJson~> 5.0.0
PINCache~> 2.3
CardIO~> 5.4.1
MBProgressHUD~> 1.1.0
ActionSheetPicker-3.0~> 2.4.2
 

PayTabs 4.3.3

  • By
  • PayTabs

PayTabs iOS SDK

Paytabs-ios-library-v4.3.2 xcode-v10.1 CocoaPods

For more information please see the website.

Installation

CocoaPods

Simply add the following line to your Podfile:

pod 'PayTabs', '~> 4.3.2'

Manual

Download SDK and Resource bundle then read the documentation to know how to integrate your application with the library documentation

Static framework requires at minimum deployment target 9.0.

You have to include the following dependencies in your Podfile:

  pod 'BIObjCHelpers'
  pod 'AFNetworking', '~> 4.0.1'
  pod 'Mantle'
  pod 'Reachability'
  pod 'Lockbox'
  pod 'SBJson'
  pod 'PINCache'
  pod 'CardIO'
  pod 'MBProgressHUD', '~> 1.1.0'
  pod 'ActionSheetPicker-3.0'

You might face an issue when you try to install the SDK manually while "ENABLE_BITCODE" flag enabled, you will have to include the following script to your Podfile:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['BITCODE_GENERATION_MODE'] = 'bitcode'
            config.build_settings['ENABLE_BITCODE'] = 'YES'
        end
    end
end

Usage

Pay with PayTabs

  • To skip the shipping info use the following method
let bundle = Bundle(url: Bundle.main.url(forResource: "Resources", withExtension: "bundle")!)
self.initialSetupViewController = PTFWInitialSetupViewController.init(
    bundle: bundle,
    andWithViewFrame: self.view.frame,
    andWithAmount: 5.0,
    andWithCustomerTitle: "PayTabs Sample App",
    andWithCurrencyCode: "USD",
    andWithTaxAmount: 0.0,
    andWithSDKLanguage: "en",
    andWithBillingAddress: "Dubai",
    andWithBillingCity: "Dubai",
    andWithBillingCountry: "ARE",
    andWithBillingState: "Dubai",
    andWithBillingZIPCode: "12345",
    andWithOrderID: "12345",
    andWithPhoneNumber: "009730000000",
    andWithCustomerEmail: "[email protected]",
    andIsTokenization:true,
    andIsPreAuth: false,
    andWithMerchantEmail: "[email protected]",
    andWithMerchantSecretKey: "kuTEjyEMhpVSWTwXBSOSeiiDAeMCOdyeuFZKiXAlhzjSKqswUWAgbCaYFivjvYzCWaWJbRszhjZuEQqsUycVzLddSyMIaZiQLlRqlp",
    andWithMerchantRegion: "emirates", //egypt, saudi, oman, jordan
    andWithAssigneeCode: "SDK",
    andWithThemeColor:UIColor.red,
    andIsThemeColorLight: false)
  • To pass the billing & shipping info use the following method
let bundle = Bundle(url: Bundle.main.url(forResource: "Resources", withExtension: "bundle")!)
self.initialSetupViewController = PTFWInitialSetupViewController.init(
    bundle: bundle,
    andWithViewFrame: self.view.frame,
    andWithAmount: 5.0,
    andWithCustomerTitle: "PayTabs Sample App",
    andWithCurrencyCode: "USD",
    andWithTaxAmount: 0.0,
    andWithSDKLanguage: "en",
    andWithShippingAddress: "Dubai",
    andWithShippingCity: "Dubai",
    andWithShippingCountry: "ARE",
    andWithShippingState: "Dubai",
    andWithShippingZIPCode: "123456",
    andWithBillingAddress: "Dubai",
    andWithBillingCity: "Dubai",
    andWithBillingCountry: "ARE",
    andWithBillingState: "Dubai",
    andWithBillingZIPCode: "12345",
    andWithOrderID: "12345",
    andWithPhoneNumber: "009730000000",
    andWithCustomerEmail: "[email protected]",
    andIsTokenization:true,
    andIsPreAuth: false,
    andWithMerchantEmail: "[email protected]",
    andWithMerchantSecretKey: "kuTEjyEMhpVSWTwXBSOSeiiDAeMCOdyeuFZKiXAlhzjSKqswUWAgbCaYFivjvYzCWaWJbRszhjZuEQqsUycVzLddSyMIaZiQLlRqlp",
    andWithMerchantRegion: "emirates", //egypt, saudi, oman, jordan
    andWithAssigneeCode: "SDK",
    andWithThemeColor:UIColor.red,
    andIsThemeColorLight: false)

Pay with Apple Pay


Apple Pay Guidelines

The SDK doesn't add the apple pay button, please use PKPaymentButton, and call our API once user click the button. You have to add the button according to Apple human interface guidelines.

Configure Apple Pay

Check apple pay requirements before getting started with configuration.

Enable Apple Pay in XCode

  1. In the Project navigator of the main window, select the project (the root group with the same name as your app).

  2. In the project editor that appears on the right, select the target.

  3. Choose the target for the app from either the Project/Targets pop-up menu or in the Targets section of the outline view.

  4. Then click the Signing & Capabilities tab in the project editor.

  5. Click on ( + Capability) to open the Capabilities library, The choose Sing in with Apple and double on it.

image

  1. Add your merchant identifier ( You will use it later with andWithMerchantApplePayIdentifier)

image

Payment processing certificate

  1. Generate CSR via PT2 merchant dashboard/ Certificate Management and Download generated CSR on Apple Pay developer portal.

  1. Download the certificate from Apple pay developer portal and upload it via PT2 merchant dashboard/ Certificate Management and entering Merchant Identifier.

Apple Pay testing

To learn how to create Apple Pay sandbox tester and use test cards please visit this link https://developer.apple.com/apple-pay/sandbox-testing/


Now you are ready to start payment with Apple Pay

Use andForceShippingInfo parameter to make the shipping info mandatory or optional.

let bundle = Bundle(url: Bundle.main.url(forResource: "Resources", withExtension: "bundle")!)
self.initialSetupViewController = PTFWInitialSetupViewController.init(applePayWith: bundle,
    andWithViewFrame: view.frame,
    andWithAmount: 1.0,
    andWithCustomerTitle: "Pay With Apple Pay",
    andWithCurrencyCode: "AED",
    andWithCountryCode: "AE",
    andForceShippingInfo: false,
    andWithSDKLanguage: "en",
    andWithOrderID: "123456",
    andIsTokenization: true,
    andIsPreAuth: false,
    andWithMerchantEmail: "[email protected]",
    andWithMerchantSecretKey: "kuTEjyEMhpVSWTwXBSOSeiiDAeMCOdyeuFZKiXAlhzjSKqswUWAgbCaYFivjvYzCWaWJbRszhjZddQqsUycVzLSyMIaZiQLlRqlp",
    andWithMerchantApplePayIdentifier: "merchant.bundleid",
    andWithSupportedNetworks: [.visa, .masterCard, .amex, .mada],
    andWithMerchantRegion: "emirates", //egypt, saudi, oman, jordan
    andWithAssigneeCode: "SDK")

Payment callbacks :

self.initialSetupViewController.didReceiveBackButtonCallback = {
    
}

self.initialSetupViewController.didStartPreparePaymentPage = {
    // Start Prepare Payment Page
    // Show loading indicator
}
self.initialSetupViewController.didFinishPreparePaymentPage = {
    // Finish Prepare Payment Page
    // Stop loading indicator
}

self.initialSetupViewController.didReceiveFinishTransactionCallback = {(responseCode, result, transactionID, tokenizedCustomerEmail, tokenizedCustomerPassword, token, transactionState, statementReference, traceCode) in
    print("Response Code: \(responseCode)")
    print("Response Result: \(result)")
    print("Statement Reference: \(statementReference)");
    print("Trace Code: \(traceCode)");
    
    // In Case you are using tokenization
    print("Tokenization Cutomer Email: \(tokenizedCustomerEmail)");
    print("Tokenization Customer Password: \(tokenizedCustomerPassword)");
    print("Tokenization Token: \(token)");
}

self.view.addSubview(initialSetupViewController.view)
self.addChild(initialSetupViewController)

initialSetupViewController.didMove(toParent: self)

Supported merchant region

Pass the parameter pt_merchant_region with one value of the below list according to supported region.

  • UAE = emirates
  • Egypt = egypt
  • Saudi Arabia = saudi
  • Oman = oman
  • Jordan = jordan
  • Global =global
  • Demo = demo

Demo application

Check our complete sample.

Paytabs

Support | Terms of Use | Privacy Policy