Skip to main content

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​

  1. AR​

    • Language: Arabic
    • Use Case: Localization for Arabic-speaking users and markets

  2. EN​

    • Language: English
    • Use Case: Business language, international users

  3. FR​

    • Language: French
    • Use Case: Localization for French-speaking markets

  4. TR​

    • Language: Turkish
    • Use Case: Localization for Turkish markets

  5. UR​

    • Language: Urdu
    • Use Case: Localization for South Asian markets

  6. 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​

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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​

  1. NoneFormat​

    • Description: No specific token format required.
    • Use Case: When a token format specification is not needed.

  2. 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

  3. 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

  4. 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

  5. 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

  6. 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​

  1. SALE​

    • Description: Immediate purchase transaction where the amount is deducted directly from the customer's account and transferred to the merchant.

  2. AUTH​

    • Description: Pre-authorization transaction that reserves funds without immediate transfer, requiring explicit capture to complete the payment.

  3. 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​

  1. UNION_PAY​

    • Payment Method: UnionPay
    • Description: China UnionPay - China's primary card network and payment system

  2. STC_PAY​

    • Payment Method: STC Pay
    • Description: Saudi Telecom Company's digital wallet and payment solution.

  3. VALU​

    • Payment Method: Valu
    • Description: Buy-now-pay-later solution supported on the Egyptian market.

  4. MEEZA_QR​

    • Payment Method: Meeza (QR)
    • Description: Egyptian national payment scheme supporting QR code payments.

  5. OMAN_NET​

    • Payment Method: OmanNet Debit
    • Description: Oman's national payment system.

  6. KNET_CREDIT​

    • Payment Method: KnetPay (Credit)
    • Description: Kuwait's national payment network for credit transactions

  7. FAWRY​

    • Payment Method: Fawry
    • Description: Egyptian payment platform

  8. KNET_DEBIT​

    • Payment Method: KnetPay (Debit)
    • Description: Kuwait's national payment network for debit transactions.

  9. URPAY​

    • Payment Method: UrPay
    • Description: Saudi Arabian digital wallet and payment solution.

  10. AMAN​

    • Payment Method: Aman
    • Description: Egyptian payment platform.

  11. SAMSUNG_PAY​

    • Payment Method: SamsungPay
    • Description: Samsung's mobile payment and digital wallet service.

  12. SOUHOOLA​

    • Payment Method: Valu
    • Description: Buy-now-pay-later and personal finance platform.

  13. TABBY​

    • Payment Method: Tabby
    • Description: Buy-now-pay-later solution.

  14. HALAN​

    • Payment Method: Halan
    • Description: Egyptian payment platform.

  15. TRU​

    • Payment Method: Tru (Shahry)
    • Description: Egyptian payment platform.

  16. TAMARA​

    • Payment Method: Tamara
    • Description: Buy-now-pay-later platform

  17. FORSA​

    • Payment Method: Forsa
    • Description: Buy-now-pay-later platform.

We are glad to be always in help. We aim to serve you better each time. As such, please spare a minute to share feedback about your recent experience with PayTabs Developers , on Trustpilot, or Google Reviews.