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:
- Payment Page Language (Locale)
- Tokenise types
- Token Formats
- Transaction Type
- Alternative Payment Methods
Payment Page Language (Locale)
The default type is DEFAULT
enum PaymentSdkLocale { AR, EN, DEFAULT, }
You can pass/use it as shown below:
import 'package:flutter_paytabs_bridge/PaymentSdkLocale.dart'; configData.locale = PaymentSdkLocale.EN;
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 PaymentSdkTokeniseType { NONE, // tokenise is off USER_OPTIONAL, // tokenise is optional as per user USER_MANDATORY, // tokenise is forced as per user approval MERCHANT_MANDATORY // tokenise is forced }
You can pass/use it as shown below:
import 'package:flutter_paytabs_bridge/PaymentSdkTokenFormat.dart'; import 'package:flutter_paytabs_bridge/PaymentSdkTokeniseType.dart'; configData.tokeniseType = PaymentSdkTokeniseType.MERCHANT_MANDATORY; configData.tokenFormat = PaymentSdkTokenFormat.AlphaNum20Format;
Token Formats
This option indicates the type of tokenization used. This field is required for creating tokenized (recurring) transactions.
The default format is null.
enum PaymentSdkTokenFormat { Hex32Format, NoneFormat, AlphaNum20Format, Digit22Format, Digit16Format, AlphaNum32Format }
You can pass/use it as shown below:
import 'package:flutter_paytabs_bridge/PaymentSdkTokenFormat.dart'; import 'package:flutter_paytabs_bridge/PaymentSdkTokeniseType.dart'; configData.tokeniseType = PaymentSdkTokeniseType.MERCHANT_MANDATORY; configData.tokenFormat = PaymentSdkTokenFormat.AlphaNum20Format;
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".
enum PaymentSdkTransactionType {
SALE,
AUTH
}
You can pass/use it as shown below:
import 'package:flutter_paytabs_bridge/PaymentSdkTransactionType.dart'; configData.transactionType = PaymentSdkTransactionType.SALE;
Alternative Payment Methods
Used to add another payment method in the payment form screen (such as Aman, StcPay, OmanNet, .. etc) or not.
enum PaymentSdkAPms { UNION_PAY, STC_PAY, VALU, MEEZA_QR, OMAN_NET, KNET_CREDIT, KNET_DEBIT, URPAY, AMAN }
You can pass/use it as shown below:
import 'package:flutter_paytabs_bridge/PaymentSdkApms.dart'; List<PaymentSdkAPms> apms = []; apms.add(PaymentSdkAPms.STC_PAY,PaymentSdkApms.VALU); configData.alternativePaymentMethods = apms;
⌂ To get familiar with the whole process and the other steps, kindly navigate to our "The Flutter (Bridge) 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.