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:


Payment Page Language

This option indicates the language of the payment page that you want to display the page with to your customer.


The default type is EN


enum class PaymentSdkLanguageCode{
    EN,
    AR
}


You can pass/use it as shown below:

configData.setLanguageCode(PaymentSdkLanguageCode.AR) 



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


enum class PaymentSdkTokenise {
    NONE,                                       // tokenise is off
   MERCHANT_MANDATORY,         // tokenise is forced
  USER_MANDATORY,                  // tokenise is forced as per user approval
  USER_OPTIONAL                      // tokenise if optional as per user approval
}


You can pass/use it as shown below:

configData.setTokenise(PaymentSdkTokenise.MERCHANT_MANDATORY, PaymentSdkTokenFormat.Hex32Format()) 



Token Formats


This option indicates the type of tokenization used. This field is required for creating tokenized (recurring) transactions. 


The default format is hex32.


sealed class PaymentSdkTokenFormat(var value: String) {
    class NoneFormat : PaymentSdkTokenFormat("1")
    class Hex32Format : PaymentSdkTokenFormat("2")
    class AlphaNum20Format : PaymentSdkTokenFormat("3")
    class Digit22Format : PaymentSdkTokenFormat("4")
    class Digit16Format : PaymentSdkTokenFormat("5")
    class AlphaNum32Format : PaymentSdkTokenFormat("6")
}


You can pass/use it as shown below:

configData.setTokenise(PaymentSdkTokenise.MERCHANT_MANDATORY, PaymentSdkTokenFormat.Hex32Format()) 

Transaction Type


This option is the identification of the type of transactionTo 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".


enum class PaymentSdkTransactionType {
    SALE,
    AUTH
}


You can pass/use it as shown below:

configData.setTransactionType(PaymentSdkTransactionType.SALE)



Alternative Payment Methods


Used to add another payment method in the payment form screen (such as Valu, StcPay, OmanNet, .. etc) or not.


enum class PaymentSdkApms {
     UNION_PAY, 
    STC_PAY, 
    VALU, 
    MEEZA_QR,
    OMAN_NET, 
    KNET_CREDIT, 
    KNET_DEBIT
}


You can pass/use it as shown below:

configData.setAlternativePaymentMethods(listOf(PaymentSdkApms.VALU, PaymentSdkApms.MEEZA_QR))




⌂ To get familiar with the whole process and the other steps, kindly navigate to our "The Native Android 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.