Enums
This article is dedicated to walking you through how to manage Enums in this Native Android 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.
SDK localization optionsβ
The PaymentSdkLanguageCode enumeration defines the supported language codes for localization within the Payment SDK. This enum implements Parcelable, allowing it to be efficiently passed between Android components such as Activities, Fragments, and Services.
How to and when to use, with the values list
Enum Declarationβ
enum class PaymentSdkLanguageCode : Parcelable {
AR,
EN,
FR,
TR,
UR,
DEFAULT
}
How to use?β
val locale = PaymentSdkLanguageCode.AR
val configData = PaymentSdkConfigBuilder(profileId, serverKey, clientKey, amount, currency)
.setLanguageCode(locale)
.build()
Supported Valuesβ
ARβ
- Language: Arabic
- Use Case: Localization for Arabic-speaking users and markets
ENβ
- Language: English
- Use Case: Business language, international users
FRβ
- Language: French
- Use Case: Localization for French-speaking markets
TRβ
- Language: Turkish
- Use Case: Localization for Turkish markets
URβ
- Language: Urdu
- Use Case: Localization for South Asian markets
DEFAULTβ
- Language: System Default
- Use Case: For automatic localization
Tokenise typesβ
The PaymentSdkTokenise enumeration defines the tokenization options available for payment processing within the Payment SDK. Tokenization is a security measure that replaces sensitive payment data with unique identifiers (tokens) that can be safely stored and used for future transactions while reducing PCI DSS compliance scope.
How to and when to use, with the values list
Enum Declarationβ
enum class PaymentSdkTokenise {
NONE,
MERCHANT_MANDATORY,
USER_MANDATORY,
USER_OPTIONAL,
USER_OPTIONAL_DEFAULT_ON
}
How to use?β
var tokeniseType = PaymentSdkTokenise.USER_OPTIONAL
val configData = PaymentSdkConfigBuilder(profileId, serverKey, clientKey, amount, currency)
.setTokenise(tokeniseType, tokenFormat)
.build()
Supported Valuesβ
NONEβ
- Description: Tokenization is completely disabled. No payment tokens will be generated or stored for future use.
- Use Case: Suitable for one-time transactions, guest checkouts, or scenarios where card details don't need to be saved.
MERCHANT_MANDATORYβ
- Description: Tokenization is required and enforced by merchant configuration. All successful transactions automatically generate tokens.
- Use Case: Subscription services, recurring billing, or merchant platforms that require stored payment methods for operational needs.
USER_MANDATORYβ
- Description: Tokenization is mandatory from user perspective, typically for user approval.
- Use Case: Regulated financial environments, membership programs, or platforms where tokenization is part of terms of service.
USER_OPTIONALβ
- Description: Tokenization is available as an opt-in feature that users can choose to enable. Will be disabled by default on the payment screen.
- Use Case: E-commerce platforms wanting to offer card saving convenience while maintaining user choice.
USER_OPTIONAL_DEFAULT_ONβ
- Description: Tokenization is optional but enabled by default, allowing users to opt out.
- Use Case: Platforms aiming to increase tokenization rates for better user retention while maintaining choice.
Token Formatsβ
The PaymentSdkTokenFormat sealed class defines the supported token format types for payment tokenization within the Payment SDK. Token formats determine the structure, length, and character composition of generated payment tokens, which is crucial for interoperability with different payment processors and systems.
How to and when to use, with the values list
Enum Declarationβ
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")
}
How to use?β
var tokenFormat = PaymentSdkTokenFormat.AlphaNum32Format()
val configData = PaymentSdkConfigBuilder(profileId, serverKey, clientKey, amount, currency)
.setTokenise(tokeniseType, tokenFormat)
.build()
Supported Valuesβ
NoneFormatβ
- Description: No specific token format required.
- Use Case: When a token format specification is not needed.
Hex32Formatβ
- Description: 32-character hexadecimal token format.
- Use Case: Common format for cryptographic tokens.
- Token Characteristics:
- Length: 32 characters
- Characters: 0-9, a-f (lowercase hexadecimal)
- Pattern: [0-9a-f]{32}
- Example: a1b2c3d4e5f678901234567890123456
AlphaNum20Formatβ
- Description: 20-character alphanumeric token format
- Use Case: Compact token format for systems with length constraints.
- Token Characteristics:
- Length: 20 characters
- Characters: A-Z, a-z, 0-9
- Pattern: [A-Za-z0-9]{20}
- Example: AbC123XyZ987qWeRtY45
Digit22Formatβ
- Description: 22-character numeric token format.
- Use Case: Numeric-only systems, compatibility with legacy payment systems.
- Token Characteristics:
- Length: 22 characters
- Characters: 0-9 only
- Pattern: [0-9]{22}
- Example: 1234567890123456789012
Digit16Formatβ
- Description: 16-character numeric token format.
- Use Case: Shorter numeric tokens, similar to credit card number length.
- Token Characteristics:
- Length: 16 characters
- Characters: 0-9 only
- Pattern: [0-9]{16}
- Example: 4111111111111111
AlphaNum32Formatβ
- Description: 32-character alphanumeric token format
- Use Case: Longer tokens requiring higher entropy while maintaining readability
- Token Characteristics:
- Length: 32 characters
- Characters: A-Z, a-z, 0-9
- Pattern: [A-Za-z0-9]{32}
- Example: Ab1Cd2Ef3Gh4Ij5Kl6Mn7Op8Qr9St0Uv
Transaction Typesβ
The PaymentSdkTransactionType enumeration defines the types of financial transactions supported by the Payment SDK. Each transaction type serves a specific purpose in the payment processing lifecycle, from immediate purchases to pre-authorizations and card registration for future payments.
How to and when to use, with the values list
Enum Declarationβ
enum class PaymentSdkTransactionType {
SALE,
AUTH,
REGISTER
}
How to use?β
var transType = PaymentSdkTransactionType.SALE
val configData = PaymentSdkConfigBuilder(profileId, serverKey, clientKey, amount, currency)
.setTransactionType(transType)
.build()
Supported Valuesβ
SALEβ
- Description: Immediate purchase transaction where the amount is deducted directly from the customer's account and transferred to the merchant.
AUTHβ
- Description: Pre-authorization transaction that reserves funds without immediate transfer, requiring explicit capture to complete the payment.
REGISTERβ
- Description: Card verification and registration for future payments without immediate charging, equivalent to auth + void in a single request.
Alternative Payment Methodsβ
The PaymentSdkApms enumeration defines the supported Alternative Payment Methods (APMs) within the Payment SDK. APMs are non-traditional payment solutions that provide region-specific, or innovative payment options beyond standard credit/debit cards.
How to and when to use, with the values list
Enum Declarationβ
enum class PaymentSdkApms {
UNION_PAY,
STC_PAY,
VALU, MEEZA_QR,
OMAN_NET,
KNET_CREDIT,
FAWRY,
KNET_DEBIT,
URPAY,
AMAN,
SAMSUNG_PAY,
SOUHOOLA,
TABBY,
HALAN,
TRU,
TAMARA,
FORSA
}
How to use?β
var alternativePaymentMethods = listOf(PaymentSdkApms.STC_PAY)
val configData = PaymentSdkConfigBuilder(profileId, serverKey, clientKey, amount, currency)
.setAlternativePaymentMethods(alternativePaymentMethods)
.build()
Supported Valuesβ
UNION_PAYβ
- Payment Method: UnionPay
- Description: China UnionPay - China's primary card network and payment system
STC_PAYβ
- Payment Method: STC Pay
- Description: Saudi Telecom Company's digital wallet and payment solution.
VALUβ
- Payment Method: Valu
- Description: Buy-now-pay-later solution supported on the Egyptian market.
MEEZA_QRβ
- Payment Method: Meeza (QR)
- Description: Egyptian national payment scheme supporting QR code payments.
OMAN_NETβ
- Payment Method: OmanNet Debit
- Description: Oman's national payment system.
KNET_CREDITβ
- Payment Method: KnetPay (Credit)
- Description: Kuwait's national payment network for credit transactions
FAWRYβ
- Payment Method: Fawry
- Description: Egyptian payment platform
KNET_DEBITβ
- Payment Method: KnetPay (Debit)
- Description: Kuwait's national payment network for debit transactions.
URPAYβ
- Payment Method: UrPay
- Description: Saudi Arabian digital wallet and payment solution.
AMANβ
- Payment Method: Aman
- Description: Egyptian payment platform.
SAMSUNG_PAYβ
- Payment Method: SamsungPay
- Description: Samsung's mobile payment and digital wallet service.
SOUHOOLAβ
- Payment Method: Valu
- Description: Buy-now-pay-later and personal finance platform.
TABBYβ
- Payment Method: Tabby
- Description: Buy-now-pay-later solution.
HALANβ
- Payment Method: Halan
- Description: Egyptian payment platform.
TRUβ
- Payment Method: Tru (Shahry)
- Description: Egyptian payment platform.
TAMARAβ
- Payment Method: Tamara
- Description: Buy-now-pay-later platform
FORSAβ
- Payment Method: Forsa
- Description: Buy-now-pay-later platform.