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.
static TokeniseType = { "none":"none", // tokenise is off "merchantMandatory":"merchantMandatory", // tokenise is forced "userMandatory":"userMandatory", // tokenise is forced as per user approval "userOptional":"userOptional", // tokenise if optional as per user approval, default is off. "userOptionalDefaultOn": "userOptionalDefaultOn" // tokenise if optional as per user approval, default is on. };
You can pass/use it as shown below:
import {PaymentSDKConstants,} from '@paytabs/react-native-paytabs';
configuration.tokeniseType = PaymentSDKConstants.TokeniseType.userOptinoal
Token Formats
This option indicates the type of tokenization used. This field is required for creating tokenized (recurring) transactions.
static TokeniseFormat = {
"none":"1",
"hex32": "2",
"alphaNum20": "3",
"digit22": "3",
"digit16": "5",
"alphaNum32": "6"
};
You can pass/use it as shown below:
import {PaymentSDKConstants,} from '@paytabs/react-native-paytabs';
configuration.tokenFormat = PaymentSDKConstants.TokeniseFormat.hex32
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.
static TransactionType = {
"sale":"sale",
"authorize": "auth"
};
You can pass/use it as shown below:
import {PaymentSDKConstants,} from '@paytabs/react-native-paytabs';
configuration.transactionType = PaymentSDKConstants.TransactionType.sale
Alternative Payment Methods
Used to add another payment method in the payment form screen (such as aman, StcPay, OmanNet, .. etc) or not.
static AlternativePaymentMethod = {
"unionPay":"unionpay",
"stcPay":"stcpay",
"valu": "valu",
"meezaQR": "meezaqr",
"omannet": "omannet",
"knetCredit": "knetcredit",
"knetDebit": "knetdebit",
"aman": "aman",
"urpay": "urpay"
};
You can pass/use it as shown below:
import {PaymentSDKConstants,} from '@paytabs/react-native-paytabs';
configuration.alternativePaymentMethods = [PaymentSDKConstants.AlternativePaymentMethod.stcPay, ...]
⌂ To get familiar with the whole process and the other steps, kindly navigate to our "The React Native 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.