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 customize 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

export enum TokeniseType {
	//none: tokenise is off
	none = "none",
	//merchantMandatory: tokenise is forced
	merchantMandatory = "merchantMandatory",

	//userMandatory: tokenise is forced as per user approval
	userMandatory = "userMandatory",

	//userOptinoal: tokenise if optional as per user approval
	userOptinoal = "userOptinoal",
configuration.tokeniseType = cordova.plugins.CordovaPaymentPlugin.TokeniseType.userOptinoal

Token Formats

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

The default format is hex32

export enum TokeniseFromat {
	//none: no format
	none = "1", 

	 //hex32: Hex with 32 length
	hex32 = "2", 

	//alphaNum20: alpha numeric 20 length
	alphaNum20 = "3", 

	//digit22: digits with 22 length
	digit22 = "3", 

	//digit16: digits with 16 length
	digit16 = "5", 

	//alphaNum32: alpha numeric 32 length
	alphaNum32 = "6"
configuration.tokeniseFormat = cordova.plugins.CordovaPaymentPlugin.TokeniseFromat.hex32

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.

The default type is sale

export enum TransactionType {
	sale = "sale", 

	//authorize / capture option
	authorize = "auth"

You can pass/use it as shown below:

configuration.transactionType =

Alternative Payment Methods

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

export enum AlternativePaymentMethod {
// unionpay: for supporting payment with unionpay
unionPay = "unionpay",

//stcpay: for supporting payment with stcpay
stcPay = "stcpay",

//valu: for supporting payment with valu
valu = "valu",

//meezaqr: for supporting payment with meezaqr
meezaQR = "meezaqr",

//omannet: for supporting payment with omannet
omannet = "omannet",

//knetcredit: for supporting payment with knetcredit
knetCredit = "knetcredit",

//knetdebit: for supporting payment with knetdebit
knetDebit = "knetdebit"

You can pass/use it as shown below:

configuration.alternativePaymentMethods = [cordova.plugins.CordovaPaymentPlugin.AlternativePaymentMethod.stcPay, ...]

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