PayTabs SDK makes the integration with the PayTabs payment gateway very easy by providing a ready-made payment screen that handles the card entry, and billing & shipping information and completes the missing details.

This article is dedicated to walking you through how to manage delegates in this SDK.

Delegate is simply just a means of communication between objects of iOS applications. You can think of delegation as a simple way of connecting objects and communicating with each other. In other words, we can say that delegate allows one object to send a message to other objects when an event occurs.

And in this section, you will have a sample of how you will receive the transaction details and errors using delegates as shown below:

extension ViewController: PaymentManagerDelegate {
    func paymentManager(didFinishTransaction transactionDetails: PaymentSDKTransactionDetails?, error: Error?) {
        if let transactionDetails = transactionDetails {
            print("Response Code: " + (transactionDetails.paymentResult?.responseCode ?? ""))
            print("Result: " + (transactionDetails.paymentResult?.responseMessage ?? ""))
            print("Token: " + (transactionDetails.token ?? ""))
            print("Transaction Reference: " + (transactionDetails.transactionReference ?? ""))
            print("Transaction Time: " + (transactionDetails.paymentResult?.transactionTime ?? "" ))
       if transactionDetails.isSuccess() {
                print("Successful transaction")
        } else if let error = error {
            // Handle errors

To get familiar with the whole process and the other steps, kindly navigate to our "The Native IOS SDK Integration Manual" solution article. 

 And to navigate to the previous step in the integration process "Step 1 - Setup and activate the integration method" kindly click here.

 And to get familiar with the rest of the steps regarding the current step "Step 2 - Configure the integration method" click here. 

Or you can navigate to the next step in the integration process "Step 3 - Initiating the payment" kindly click here.