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 Enums in this SDK.
An enumeration defines a common type for a group of related values and enables you to work with those values in a type-safe way within your code.
Hence, here are the predefined enums by PayTabs that will help you in customizing your configuration as shown below:
Tokenise types
This option is used only when you want to tokenize the transaction for any further recurring transactions. This indicates whether the tokenization is optional or mandatory or if no tokenization will be done at all.
This field is required for creating tokenized (recurring) transactions.
The default type is none
public enum TokeniseType: Int, Codable { case none // tokenise is off case merchantMandatory // tokenise is forced case userMandatory // tokenise is forced as per user approval case userOptinoal // tokenise if optional as per user approval }
You can pass/use it as shown below:
configuration.tokeniseType = .sale
Token Formats
This option indicates the type of tokenization used. This field is required for creating tokenized (recurring) transactions.
The default format is hex32.
public enum TokenFormat: String { case none = "1" case hex32 = "2" case alphaNum20 = "3" case digit22 = "4" case digit16 = "5" case alphaNum32 = "6" }
You can pass/use it as shown below:
configuration.tokenFormat = .sale
Transaction Type
This option is the identification of the type of transaction. To know more about these types please check our What is the "tran_type" (transaction type)? solution article.
- This is a required configuration parameter to perform any transaction.
- Only "Sale" and "Auth" types are supported in this SDK.
- The default type is "Sale".
public enum TransactionType: String, CaseIterable { case sale case authorize = "auth" }
You can pass/use it as shown below:
configuration.transactionType = .sale
Alternative Payment Methods
Used to add another payment method in the payment form screen (such as valu, StcPay, OmanNet, .. etc) or not.
public enum AlternativePaymentMethod: String { case unionPay = "unionpay" case stcPay = "stcpay" case valu case meezaQR = "meezaqr" case omannet case knetCredit = "knetcredit" case knetDebit = "knetdebit" }
You can pass/use it as shown below:
configuration.alternativePaymentMethod= .meezaQR
⌂ 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.