React Native Models Documentation

This documentation provides detailed information about the models used in the React Native SDK. Each model includes a code snippet and a comprehensive description of its properties and usage.

1. Language

export enum Language {
  ARABIC = 'ar',
  ENGLISH = 'en',
  FRENCH = 'fr',
}
  • Description: Enum representing different languages supported by the SDK.
  • Enum Cases:
    • ARABIC: Arabic language.
    • ENGLISH: English language.
    • FRENCH: French language.

2. LogLevel

export enum LogLevel {
  VERBOSE = 'VERBOSE',
  DEBUG = 'DEBUG',
  INFO = 'INFO',
  WARN = 'WARN',
  ERROR = 'ERROR',
  ASSERTION = 'ASSERT',
}
  • Description: Enum representing different levels of logging.
  • Enum Cases:
    • VERBOSE: Verbose logging.
    • DEBUG: Debug-level logging.
    • INFO: Informational messages.
    • WARN: Warning messages.
    • ERROR: Error messages.
    • ASSERTION: Assertion failures.

3. DiscountType

export enum DiscountType {
  AMOUNT = 'amount',
  PERCENTAGE = 'percentage',
}
  • Description: Enum representing the type of discount.
  • Enum Cases:
    • AMOUNT: The discount is a fixed amount.
    • PERCENTAGE: The discount is a percentage of the total.

4. DiscountItem

export class DiscountItem {
  title?: Map<Language, string>;
  type?: DiscountType;
  value?: string;

  constructor(
    title?: Map<Language, string>,
    type?: DiscountType,
    value?: string
  ) {
    this.title = title;
    this.type = type;
    this.value = value;
  }
}
  • Description: Represents a discount applied to a fee or intent.
  • Properties:
    • title: A map of titles by language, describing the discount.
    • type: The type of discount (DiscountType).
    • value: The value of the discount.

5. DiscountData

export class DiscountData {
  discount?: DiscountItem;
  amount?: string;

  constructor(discount?: DiscountItem, amount?: string) {
    this.discount = discount;
    this.amount = amount;
  }
}
  • Description: Represents data related to a discount applied to an intent.
  • Properties:
    • discount: The DiscountItem associated with the intent.
    • amount: The amount after the discount is applied.

6. FeeItem

export class FeeItem {
  title: Map<Language, string>;
  value: string;

  constructor(title: Map<Language, string>, value: string) {
    this.title = title;
    this.value = value;
  }
}
  • Description: Represents a fee item associated with an intent.
  • Properties:
    • title: A map of titles by language, describing the fee.
    • value: The value of the fee.

7. FeesData

export class FeesData {
  amount?: string;
  fees?: FeeItem[];

  constructor(amount?: string, fees?: FeeItem[]) {
    this.amount = amount;
    this.fees = fees;
  }
}
  • Description: Represents the fees data associated with the intent.
  • Properties:
    • amount: The total amount of the fees.
    • fees: A list of FeeItem objects representing individual fees.

8. MHErrorType

export enum MHErrorType {
  NETWORK = 'network',
  UNKNOWN = 'unknown',
  CARD_VALIDATION = 'cardValidation',
  CANCELLED = 'cancelled',
  APPLE_PAY_TRANSACTION_FAILED = 'applePayTransactionFailed',
  NOT_COMPATIBLE_WITH_APPLE_PAY = 'notCompatibleWithApplePay',
}
  • Description: Enum representing different types of errors that can occur in the SDK.
  • Enum Cases:
    • NETWORK: Network-related error.
    • UNKNOWN: An unknown error.
    • CARD_VALIDATION: Error related to card validation.
    • CANCELLED: The operation was cancelled.
    • APPLE_PAY_TRANSACTION_FAILED: Apple Pay transaction failed.
    • NOT_COMPATIBLE_WITH_APPLE_PAY: Device is not compatible with Apple Pay.

9. ErrorDetail

export class ErrorDetail {
  key: string;
  message: string;

  constructor(key: string, message: string) {
    this.key = key;
    this.message = message;
  }
}
  • Description: Represents detailed information about an error.
  • Properties:
    • key: The error key or code.
    • message: The error message.

10. MHError

export class MHError extends Error {
  message: string;
  errors: ErrorDetail[];
  type: MHErrorType;

  constructor(message: string, errors: ErrorDetail[], type: MHErrorType) {
    super(message);
    this.message = message;
    this.errors = errors;
    this.type = type;
  }
}
  • Description: Represents an error occurring in the SDK.
  • Properties:
    • message: The error message.
    • errors: An array of detailed error information (ErrorDetail).
    • type: The type of error (MHErrorType).

11. AmountData

export class AmountData {
  value?: string;
  formatted?: number;
  currency?: string;
  maxPayout?: number;

  constructor(params: {
    value?: string;
    formatted?: number;
    currency?: string;
    maxPayout?: number;
  }) {
    this.value = params.value;
    this.formatted = params.formatted;
    this.currency = params.currency;
    this.maxPayout = params.maxPayout;
  }
}
  • Description: Represents the monetary value related to an intent.
  • Properties:
    • value: The raw value of the amount.
    • formatted: The formatted amount value.
    • currency: The currency code (e.g., "USD").
    • maxPayout: The maximum payout amount allowed.

12. CardTokenData

export class CardTokenData {
  bin?: string;
  brand?: string;
  cardHolderName?: string;
  country?: string;
  expiryMonth?: string;
  expiryYear?: string;
  issuer?: string;
  last4?: string;
  logo?: string;
  paymentMethods?: string[];
  requiresCvv?: boolean;

  constructor(
    bin?: string,
    brand?: string,
    cardHolderName?: string,
    country?: string,
    expiryMonth?: string,
    expiryYear?: string,
    issuer?: string,
    last4?: string,
    logo?: string,
    paymentMethods?: string[],
    requiresCvv?: boolean
  ) {
    this.bin = bin;
    this.brand = brand;
    this.cardHolderName = cardHolderName;
    this.country = country;
    this.expiryMonth = expiryMonth;
    this.expiryYear = expiryYear;
    this.issuer = issuer;
    this.last4 = last4;
    this.logo = logo;
    this.paymentMethods = paymentMethods;
    this.requiresCvv = requiresCvv;
  }
}
  • Description: Represents token data for a card used in payment processing.
  • Properties:
    • bin: Bank Identification Number of the card.
    • brand: Brand of the card (e.g., Visa, MasterCard).
    • cardHolderName: Name of the cardholder.
    • country: Country where the card was issued.
    • expiryMonth: Expiry month of the card.
    • expiryYear: Expiry year of the card.
    • issuer: Issuer of the card.
    • last4: Last four digits of the card number.
    • logo: Logo associated with the card brand.
    • paymentMethods: List of payment methods associated with the card.
    • requiresCvv: Indicates if CVV is required for transactions.

13. OptionItem

export class OptionItem {
  label: string;
  value: string;

  constructor(label: string, value: string) {
    this.label = label;
    this.value = value;
  }
}
  • Description: Represents an option item in a selectable list within an input field.
  • Properties:
    • label: The label displayed to the user.
    • value: The value associated with the option.

14. InputFieldType

export enum InputFieldType {
  TEXT = 'text',
  EMAIL = 'email',
  PHONE_NUMBER = 'phone_number',
  DATE = 'date_field',
  NUMBER = 'number_field',
  SELECT = 'choice_field',
}
  • Description: Enum representing the type of an input field.
  • Enum Cases:
    • TEXT: Standard text input field.
    • EMAIL: Email input field.
    • PHONE_NUMBER: Phone number input field.
    • DATE: Date input field.
    • NUMBER: Numeric input field.
    • SELECT: Dropdown or select input field.

15. InputField

export class InputField {
  type: InputFieldType;
  name?: string;
  value?: string;
  label?: string;
  maxLength?: number;
  isRequired: boolean;
  optionsList?: OptionItem[];
  optionsMap?: { [key: string]: OptionItem[] };
  hint?: string;
  minLength?: number;
  readOnly: boolean;
  dependsOn?: string;

  constructor(
    type: InputFieldType,
    isRequired: boolean,
    readOnly: boolean,
    name?: string,
    value?: string,
    label?: string,
    maxLength?: number,
    optionsList?: OptionItem[],
    optionsMap?: { [key: string]: OptionItem[] },
    hint?: string,
    minLength?: number,
    dependsOn?: string
  ) {
    this.type = type;
    this.name = name;
    this.value = value;
    this.label = label;
    this.maxLength = maxLength;
    this.isRequired = isRequired;
    this.optionsList = optionsList;
    this.optionsMap = optionsMap;
    this.hint = hint;
    this.minLength = minLength;
    this.readOnly = readOnly;
    this.dependsOn = dependsOn;
  }
}
  • Description: Represents a field in a form used for collecting user input.
  • Properties:
    • type: Type of the input field (InputFieldType).
    • name: Name of the input field.
    • value: Current value of the input field.
    • label: Label for the input field.
    • maxLength: Maximum length of the input.
    • isRequired: Indicates if the field is required.
    • optionsList: List of selectable options (OptionItem[]).
    • optionsMap: Map of selectable options.
    • hint: Hint message for the input field.
    • minLength: Minimum length of the input.
    • readOnly: Indicates if the field is read-only.
    • dependsOn: Specifies another field that this field depends on.

16. IntentStatus

export enum IntentStatus {
  Processed = 'PROCESSED',
  UnProcessed = 'UNPROCESSED',
  TimeExpired = 'TIME_EXPIRED',
  Closed = 'CLOSED',
}
  • Description: Enum representing the possible statuses of an intent.
  • Enum Cases:
    • Processed: The intent has been processed.
    • UnProcessed: The intent remains unprocessed.
    • TimeExpired: The intent has expired due to time constraints.
    • Closed: The intent has been closed.

17. IntentType

export enum IntentType {
  Payment = 'payment',
  Payout = 'payout',
}
  • Description: Enum representing the type of intent.
  • Enum Cases:
    • Payment: Represents a payment intent.
    • Payout: Represents a payout intent.

18. IntentData

export class IntentData {
  amount?: AmountData;
  secret?: string;
  expirationDate?: string;
  isLive?: boolean;
  id?: string;
  status?: IntentStatus;

  constructor(params: {
    amount?: AmountData;
    secret?: string;
    expirationDate?: string;
    isLive?: boolean;
    id?: string;
    status?: IntentStatus;
  }) {
    this.amount = params.amount;
    this.secret = params.secret;
    this.expirationDate = params.expirationDate;
    this.isLive = params.isLive;
    this.id = params.id;
    this.status = params.status;
  }
}
  • Description: Represents the core details of an intent.
  • Properties:
    • amount: The total amount for the intent (AmountData).
    • secret: A secret key associated with the intent.
    • expirationDate: The date when the intent expires.
    • isLive: Indicates if the intent is in live mode.
    • id: The unique identifier for the intent.
    • status: The current status of the intent (IntentStatus).

19. TransactionData

export class TransactionData {
  billingData?: string;
  amount?: number;
  externalActionMessage?: string[];
  amountCurrency?: string;
  id?: string;
  methodName?: string;
  method?: string;
  createdDate?: string;
  status?: string;
  customFields?: string;
  providerTransactionFields?: string;
  customFormAnswers?: string;

  constructor(params: {
    billingData?: string;
    amount?: number;
    externalActionMessage?: string[];
    amountCurrency?: string;
    id?: string;
    methodName?: string;
    method?: string;
    createdDate?: string;
    status?: string;
    customFields?: string;
    providerTransactionFields?: string;
    customFormAnswers?: string;
  }) {
    this.billingData = params.billingData;
    this.amount = params.amount;
    this.externalActionMessage = params.externalActionMessage || [];
    this.amountCurrency = params.amountCurrency;
    this.id = params.id;
    this.methodName = params.methodName;
    this.method = params.method;
    this.createdDate = params.createdDate;
    this.status = params.status;
    this.customFields = params.customFields;
    this.providerTransactionFields = params.providerTransactionFields;
    this.customFormAnswers = params.customFormAnswers;
  }
}
  • Description: Represents details about a transaction within an intent.
  • Properties:
    • billingData: Billing data associated with the transaction.
    • amount: The amount involved in the transaction.
    • externalActionMessage: External action messages, if any.
    • amountCurrency: The currency of the transaction amount.
    • id: The unique identifier of the transaction.
    • methodName: The name of the method used for the transaction.
    • method: The method used for the transaction.
    • createdDate: The date when the transaction was created.
    • status: The current status of the transaction.
    • customFields: Custom fields related to the transaction.
    • providerTransactionFields: Fields specific to the transaction provider.
    • customFormAnswers: Answers to any custom forms associated with the transaction.

20. ProductItem

export class ProductItem {
  name?: string;
  type?: string;
  amount?: string;
  category?: string;
  quantity?: number;
  description?: string;
  subcategory?: string;
  referenceId?: string;

  constructor(
    name?: string,
    type?: string,
    amount?: string,
    category?: string,
    quantity?: number,
    description?: string,
    subcategory?: string,
    referenceId?: string
  ) {
    this.name = name;
    this.type = type;
    this.amount = amount;
    this.category = category;
    this.quantity = quantity;
    this.description = description;
    this.subcategory = subcategory;
    this.referenceId = referenceId;
  }
}
  • Description: Represents an item associated with a product in an intent.
  • Properties:
    • name: The name of the product item.
    • type: The type of the product item.
    • amount: The amount associated with the product item.
    • category: The category of the product item.
    • quantity: The quantity of the product item.
    • description: A description of the product item.
    • subcategory: The subcategory of the product item.
    • referenceId: A reference ID associated with the product item.

21. IntentDetails

export class IntentDetails {
  selectedMethod?: string;
  intent?: IntentData;
  walletBalance?: number;
  transaction?: TransactionData;
  intentState?: IntentStateDetails;
  productItems?: ProductItem[];

  constructor(params: {
    selectedMethod?: string;
    intent?: IntentData;
    walletBalance?: number;
    transaction?: TransactionData;
    intentState?: IntentStateDetails;
    productItems?: ProductItem[];
  }) {
    this.selectedMethod = params.selectedMethod;
    this.intent = params.intent;
    this.walletBalance = params.walletBalance;
    this.transaction = params.transaction;
    this.intentState = params.intentState;
    this.productItems = params.productItems;
  }
}
  • Description: Provides detailed information about an intent.
  • Properties:
    • selectedMethod: The payment method selected for the intent.
    • intent: The IntentData object containing core details of the intent.
    • walletBalance: The wallet balance associated with the current customer.
    • transaction: Details about the transaction (TransactionData).
    • intentState: The current state of the intent (IntentStateDetails).
    • productItems: A list of product items related to the intent.

22. MethodType

export enum MethodType {
  ExpressMethod = 'expressMethod',
  CustomerBalance = 'customerBalance',
  SavedCard = 'savedCard',
  PaymentMethod = 'paymentMethod',
  PayoutMethod = 'payoutMethod',
}
  • Description: Enum representing different types of methods available for an intent.
  • Enum Cases:
    • ExpressMethod: Represents an express payment method.
    • CustomerBalance: Represents a customer balance method.
    • SavedCard: Represents a saved card method.
    • PaymentMethod: Represents a standard payment method.
    • PayoutMethod: Represents a payout method.

23. CustomerBalance

export class CustomerBalance {
  balance?: number;
  id?: string;
  icon?: string;
  isSelected?: boolean;
  type?: MethodType;

  constructor(params: {
    balance?: number;
    id?: string;
    icon?: string;
    isSelected?: boolean;
    type?: MethodType;
  }) {
    this.balance = params.balance;
    this.id = params.id;
    this.icon = params.icon;
    this.isSelected = params.isSelected;
    this.type = params.type;
  }
}
  • Description: Represents a customer balance available for use in an intent.
  • Properties:
    • balance: The balance amount.
    • id: The unique identifier of the customer balance.
    • icon: An icon associated with the balance.
    • isSelected: Indicates if this balance is selected.
    • type: The type of method (MethodType).

24. PaymentMethod

export class PaymentMethod {
  id?: string;
  title?: string;
  isSelected?: boolean;
  confirmationRequired?: boolean;
  icons?: string[];
  type?: MethodType;
  requiredBillingData?: InputField[];

  constructor(params: {
    id?: string;
    title?: string;
    isSelected?: boolean;
    confirmationRequired?: boolean;
    icons?: string[];
    type?: MethodType;
    requiredBillingData?: InputField[];
  }) {
    this.id = params.id;
    this.title = params.title;
    this.isSelected = params.isSelected;
    this.confirmationRequired = params.confirmationRequired;
    this.icons = params.icons;
    this.type = params.type;
    this.requiredBillingData = params.requiredBillingData;
  }
}
  • Description: Represents a payment method available for the user.
  • Properties:
    • id: The unique identifier of the payment method.
    • title: The title or name of the payment method.
    • isSelected: Indicates if this method is selected.
    • confirmationRequired: Indicates if confirmation is required for this method.
    • icons: Icons associated with the payment method.
    • type: The type of method (MethodType).
    • requiredBillingData: A list of input fields required for billing data (InputField[]).

25. PayoutMethod

export class PayoutMethod {
  id?: string;
  title?: string;
  isSelected?: boolean;
  confirmationRequired?: boolean;
  icons?: string[];
  type?: MethodType;
  requiredBillingData?: InputField[];

  constructor(params: {
    id?: string;
    title?: string;
    isSelected?: boolean;
    confirmationRequired?: boolean;
    icons?: string[];
    type?: MethodType;
    requiredBillingData?: InputField[];
  }) {
    this.id = params.id;
    this.title = params.title;
    this.isSelected = params.isSelected;
    this.confirmationRequired = params.confirmationRequired;
    this.icons = params.icons;
    this.type = params.type;
    this.requiredBillingData = params.requiredBillingData;
  }
}
  • Description: Represents a payout method available for the user.
  • Properties:
    • id: The unique identifier of the payout method.
    • title: The title or name of the payout method.
    • isSelected: Indicates if this method is selected.
    • confirmationRequired: Indicates if confirmation is required for this method.
    • icons: Icons associated with the payout method.
    • type: The type of method (MethodType).
    • requiredBillingData: A list of input fields required for billing data (InputField[]).

26. ExpressMethod

export class ExpressMethod {
  id?: string;
  title?: string;
  isSelected?: boolean;
  confirmationRequired?: boolean;
  icons?: string[];
  type?: MethodType;
  requiredBillingData?: InputField[];

  constructor(params: {
    id?: string;
    title?: string;
    isSelected?: boolean;
    confirmationRequired?: boolean;
    icons?: string[];
    type?: MethodType;
    requiredBillingData?: InputField[];
  }) {
    this.id = params.id;
    this.title = params.title;
    this.isSelected = params.isSelected;
    this.confirmationRequired = params.confirmationRequired;
    this.icons = params.icons;
    this.type = params.type;
    this.requiredBillingData = params.requiredBillingData;
  }
}
  • Description: Represents an express payment method.
  • Properties:
    • id: The unique identifier of the express method.
    • title: The title or name of the express method.
    • isSelected: Indicates if this method is selected.
    • confirmationRequired: Indicates if confirmation is required for this method.
    • icons: Icons associated with the express method.
    • type: The type of method (MethodType).
    • requiredBillingData: A list of input fields required for billing data (InputField[]).

27. CvvConfig

export class CvvConfig {
  digitsCount?: number;

  constructor(params: { digitsCount?: number }) {
    this.digitsCount = params.digitsCount;
  }
}
  • Description: Configuration details for entering the CVV during a transaction.
  • Properties:
    • digitsCount: The number of digits required for the CVV.

28. SavedCard

export class SavedCard {
  id?: string;
  brand?: string;
  last4?: string;
  expiryMonth?: string;
  expiryYear?: string;
  country?: string;
  logo?: string;
  requireCvv?: boolean;
  cvvConfig?: CvvConfig;
  type?: MethodType;
  bin?: string;

  constructor(params: {
    id?: string;
    brand?: string;
    last4?: string;
    expiryMonth?: string;
    expiryYear?: string;
    country?: string;
    logo?: string;
    requireCvv?: boolean;
    cvvConfig?: CvvConfig;
    type?: MethodType;
    bin?: string;
  }) {
    this.id = params.id;
    this.brand = params.brand;
    this.last4 = params.last4;
    this.expiryMonth = params.expiryMonth;
    this.expiryYear = params.expiryYear;
    this.country = params.country;
    this.logo = params.logo;
    this.requireCvv = params.requireCvv;
    this.cvvConfig = params.cvvConfig;
    this.type = params.type;
    this.bin = params.bin;
  }
}
  • Description: Represents a saved card used in transactions.
  • Properties:
    • id: The unique identifier of the saved card.
    • brand: The brand of the card (e.g., Visa, MasterCard).
    • last4: The last four digits of the card number.
    • expiryMonth: The expiry month of the card.
    • expiryYear: The expiry year of the card.
    • country: The country where the card was issued.
    • logo: The logo associated with the card brand.
    • requireCvv: Indicates if CVV is required for this card.
    • cvvConfig: Configuration related to CVV input (CvvConfig).
    • type: The type of method (MethodType).
    • bin: The Bank Identification Number (first six digits of the card).

29. IntentMethods

export class IntentMethods {
  customerBalances?: CustomerBalance[];
  paymentMethods?: PaymentMethod[];
  expressMethods?: ExpressMethod[];
  savedCards?: SavedCard[];
  payoutMethods?: PayoutMethod[];

  constructor(params: {
    customerBalances?: CustomerBalance[];
    paymentMethods?: PaymentMethod[];
    expressMethods?: ExpressMethod[];
    savedCards?: SavedCard[];
    payoutMethods?: PayoutMethod[];
  }) {
    this.customerBalances = params.customerBalances;
    this.paymentMethods = params.paymentMethods;
    this.expressMethods = params.expressMethods;
    this.savedCards = params.savedCards;
    this.payoutMethods = params.payoutMethods;
  }
}
  • Description: Represents different payment methods available for an intent.
  • Properties:
    • customerBalances: A list of available customer balances.
    • paymentMethods: A list of available payment methods.
    • expressMethods: A list of available express methods.
    • savedCards: A list of saved cards.
    • payoutMethods: A list of available payout methods.

30. IntentResult

export class IntentResult {
  methods?: IntentMethods | null;
  details?: IntentDetails | null;

  constructor(params: {
    methods?: IntentMethods | null;
    details?: IntentDetails | null;
  }) {
    this.methods = params.methods;
    this.details = params.details;
  }
}
  • Description: Represents the result of available methods for an intent.
  • Properties:
    • methods: Contains the available payment methods (IntentMethods).
    • details: Provides detailed information about the intent (IntentDetails).

31. IntentStateDetails

export type IntentStateDetails =
  | MethodSelection
  | IntentForm
  | IntentProcessed
  | TransactionWaitingUserAction
  | TransactionFailed
  | Expired
  | Closed
  | FormFields
  | UrlToRender
  | SavedCardCVV
  | CardIntentSuccessful
  | CardIntentFailed
  | NativePay;
  • Description: Represents different states an intent can be in.

MethodSelection

export class MethodSelection {
  type: 'method_selection' = 'method_selection';
  methods: IntentMethods;

  constructor(methods: IntentMethods) {
    this.methods = methods;
  }
}
  • Description: Represents the state where the user selects a payment method.
  • Properties:
    • type: A string literal 'method_selection'.
    • methods: The available methods for selection (IntentMethods).

IntentForm

export class IntentForm {
  type: 'intent_form' = 'intent_form';
}
  • Description: Represents the state where the MoneyHash form is rendered.
  • Properties:
    • type: A string literal 'intent_form'.

IntentProcessed

export class IntentProcessed {
  type: 'intent_processed' = 'intent_processed';
}
  • Description: Represents the state where the intent has been processed successfully.
  • Properties:
    • type: A string literal 'intent_processed'.

TransactionWaitingUserAction

export class TransactionWaitingUserAction {
  type: 'transaction_waiting_user_action' = 'transaction_waiting_user_action';
}
  • Description: Represents the state where the transaction is waiting for user action.
  • Properties:
    • type: A string literal 'transaction_waiting_user_action'.

TransactionFailed

export class TransactionFailed {
  type: 'transaction_failed' = 'transaction_failed';
  recommendedMethods?: IntentMethods;

  constructor(recommendedMethods?: IntentMethods) {
    this.recommendedMethods = recommendedMethods;
  }
}
  • Description: Represents the state where the transaction has failed.
  • Properties:
    • type: A string literal 'transaction_failed'.
    • recommendedMethods: Optional recommended methods for retrying the transaction (IntentMethods).

Expired

export class Expired {
  type: 'expired' = 'expired';
}
  • Description: Represents the state where the intent has expired.
  • Properties:
    • type: A string literal 'expired'.

Closed

export class Closed {
  type: 'closed' = 'closed';
}
  • Description: Represents the state where the intent has been closed.
  • Properties:
    • type: A string literal 'closed'.

FormFields

export class FormFields {
  type: 'form_fields' = 'form_fields';
  tokenizeCardInfo?: TokenizeCardInfo;
  billingFields?: InputField[];
  shippingFields?: InputField[];

  constructor(params: {
    tokenizeCardInfo?: TokenizeCardInfo;
    billingFields?: InputField[];
    shippingFields?: InputField[];
  }) {
    this.tokenizeCardInfo = params.tokenizeCardInfo;
    this.billingFields = params.billingFields;
    this.shippingFields = params.shippingFields;
  }
}
  • Description: Represents the state where form fields are being filled out.
  • Properties:
    • type: A string literal 'form_fields'.
    • tokenizeCardInfo: Information needed to tokenize a card (TokenizeCardInfo).
    • billingFields: List of billing input fields required (InputField[]).
    • shippingFields: List of shipping input fields required (InputField[]).

UrlToRender

export class UrlToRender {
  type: 'url_to_render' = 'url_to_render';
  url?: string;
  renderStrategy?: RenderStrategy;

  constructor(params: { url?: string; renderStrategy?: RenderStrategy }) {
    this.url = params.url;
    this.renderStrategy = params.renderStrategy;
  }
}
  • Description: Represents the state where a URL needs to be rendered or redirected.
  • Properties:
    • type: A string literal 'url_to_render'.
    • url: The URL to be rendered.
    • renderStrategy: The strategy for rendering the URL (RenderStrategy).

SavedCardCVV

export class SavedCardCVV {
  type: 'saved_card_cvv' = 'saved_card_cvv';
  cvvField: InputField;
  cardTokenData?: CardTokenData;

  constructor(params: {
    cvvField: InputField;
    cardTokenData?: CardTokenData;
  }) {
    this.cvvField = params.cvvField;
    this.cardTokenData = params.cardTokenData;
  }
}
  • Description: Represents the state where a saved card’s CVV is being entered.
  • Properties:
    • type: A string literal 'saved_card_cvv'.
    • cvvField: The CVV input field required (InputField).
    • cardTokenData: Token data for the card (CardTokenData).

CardIntentSuccessful

export class CardIntentSuccessful {
  type: 'card_intent_successful' = 'card_intent_successful';
}
  • Description: Represents the state where a card intent has been processed successfully.
  • Properties:
    • type: A string literal 'card_intent_successful'.

CardIntentFailed

export class CardIntentFailed {
  type: 'card_intent_failed' = 'card_intent_failed';
}
  • Description: Represents the state where a card intent has failed.
  • Properties:
    • type: A string literal 'card_intent_failed'.

NativePay

export class NativePay {
  type: 'native_pay' = 'native_pay';
  nativePayData?: NativePayData;

  constructor(params: { nativePayData?: NativePayData }) {
    this.nativePayData = params.nativePayData;
  }
}
  • Description: Represents the use of native payment methods like Apple Pay.
  • Properties:
    • type: A string literal 'native_pay'.
    • nativePayData: Data needed to process a native pay transaction (NativePayData).

32. MethodMetaData

export class MethodMetaData {
  cvv?: string;

  constructor(params: { cvv?: string }) {
    this.cvv = params.cvv;
  }
}
  • Description: Contains metadata related to a payment method, such as CVV.
  • Properties:
    • cvv: The CVV code for a card.

33. RenderStrategy

export enum RenderStrategy {
  IFRAME = 'iframe',
  POPUP_IFRAME = 'popup_iframe',
  REDIRECT = 'redirect',
  NONE = 'none',
}
  • Description: Enum representing different strategies for rendering web content within the SDK.
  • Enum Cases:
    • IFRAME: Content is rendered within an iframe.
    • POPUP_IFRAME: Content is rendered within a popup iframe.
    • REDIRECT: Content is rendered via a URL redirect.
    • NONE: No rendering strategy is applied.

34. SaveCardCheckbox

export class SaveCardCheckbox {
  mandatory?: boolean;
  show?: boolean;

  constructor(params: { mandatory?: boolean; show?: boolean }) {
    this.mandatory = params.mandatory;
    this.show = params.show;
  }
}
  • Description: Represents the configuration for the save card checkbox.
  • Properties:
    • mandatory: Indicates if the save card option is mandatory.
    • show: Indicates if the save card checkbox should be shown.

35. TokenizeCardInfo

export class TokenizeCardInfo {
  accessToken?: string;
  isLive?: boolean;
  saveCard?: boolean;
  saveCardCheckbox?: SaveCardCheckbox;

  constructor(params: {
    accessToken?: string;
    isLive?: boolean;
    saveCard?: boolean;
    saveCardCheckbox?: SaveCardCheckbox;
  }) {
    this.accessToken = params.accessToken;
    this.isLive = params.isLive;
    this.saveCard = params.saveCard;
    this.saveCardCheckbox = params.saveCardCheckbox;
  }
}
  • Description: Represents the data needed to tokenize a card in the payment process.
  • Properties:
    • accessToken: An access token used for tokenizing the card.
    • isLive: Indicates if the card is in live mode.
    • saveCard: Indicates if the card should be saved.
    • saveCardCheckbox: Configuration for the save card checkbox (SaveCardCheckbox).

36. NativePayData and ApplePayData

export type NativePayData = ApplePayData;

export class ApplePayData {
  type: 'apple_pay' = 'apple_pay';
  countryCode?: string;
  merchantId?: string;
  currencyCode?: string;
  amount?: number;
  supportedNetworks?: string[];

  constructor(params: {
    countryCode?: string;
    merchantId?: string;
    currencyCode?: string;
    amount?: number;
    supportedNetworks?: string[];
  }) {
    this.countryCode = params.countryCode;
    this.merchantId = params.merchantId;
    this.currencyCode = params.currencyCode;
    this.amount = params.amount;
    this.supportedNetworks = params.supportedNetworks;
  }
}
  • Description: Contains data necessary for configuring an Apple Pay transaction.
  • Properties:
    • type: A string literal 'apple_pay'.
    • countryCode: The country code for the transaction (e.g., "US").
    • merchantId: The merchant identifier for Apple Pay.
    • currencyCode: The currency code for the transaction (e.g., "USD").
    • amount: The amount to be charged.
    • supportedNetworks: A list of supported networks for Apple Pay (e.g., Visa, MasterCard).

37. CardFieldType

export enum CardFieldType {
  CARD_NUMBER = 'cardNumber',
  CARD_HOLDER_NAME = 'cardHolderName',
  EXPIRY_YEAR = 'expiryYear',
  EXPIRY_MONTH = 'expiryMonth',
  CVV = 'cvv',
}
  • Description: Enum representing different types of card fields used in forms.
  • Enum Cases:
    • CARD_NUMBER: Represents the card number field.
    • CARD_HOLDER_NAME: Represents the cardholder’s name field.
    • EXPIRY_YEAR: Represents the expiration year field.
    • EXPIRY_MONTH: Represents the expiration month field.
    • CVV: Represents the CVV field (Card Verification Value).

38. CardFieldState

export class CardFieldState {
  isValid: boolean;
  errorMessage?: string;
  length: number;

  constructor(params: { isValid: boolean; length: number; errorMessage?: string }) {
    this.isValid = params.isValid;
    this.length = params.length;
    this.errorMessage = params.errorMessage;
  }
}
  • Description: Represents the state of a card input field.
  • Properties:
    • isValid: A boolean indicating whether the input in the field is valid.
    • errorMessage: An optional string that contains an error message if the input is invalid.
    • length: The current length of the input in the field.

39. VaultData

export class VaultData {
  firstSixDigits?: string;
  lastFourDigits?: string;
  cardScheme?: string;
  cardHolderName?: string;
  expiryYear?: string;
  expiryMonth?: string;
  isLive?: boolean;
  accessToken?: string;
  cardToken?: string;
  cvv?: string;
  saveCard?: boolean;
  fingerprint?: string;

  constructor(params: {
    firstSixDigits?: string;
    lastFourDigits?: string;
    cardScheme?: string;
    cardHolderName?: string;
    expiryYear?: string;
    expiryMonth?: string;
    isLive?: boolean;
    accessToken?: string;
    cardToken?: string;
    cvv?: string;
    saveCard?: boolean;
    fingerprint?: string;
  }) {
    this.firstSixDigits = params.firstSixDigits;
    this.lastFourDigits = params.lastFourDigits;
    this.cardScheme = params.cardScheme;
    this.cardHolderName = params.cardHolderName;
    this.expiryYear = params.expiryYear;
    this.expiryMonth = params.expiryMonth;
    this.isLive = params.isLive;
    this.accessToken = params.accessToken;
    this.cardToken = params.cardToken;
    this.cvv = params.cvv;
    this.saveCard = params.saveCard;
    this.fingerprint = params.fingerprint;
  }
}
  • Description: Represents the data stored in the vault for a card used in payment processing.
  • Properties:
    • firstSixDigits: The first six digits of the card number.
    • lastFourDigits: The last four digits of the card number.
    • cardScheme: The scheme of the card (e.g., Visa, MasterCard).
    • cardHolderName: The name of the cardholder.
    • expiryYear: The expiry year of the card.
    • expiryMonth: The expiry month of the card.
    • isLive: Indicates if the card is in live mode.
    • accessToken: An access token associated with the card.
    • cardToken: A token representing the card.
    • cvv: The CVV code for the card.
    • saveCard: Indicates if the card should be saved.
    • fingerprint: A fingerprint associated with the card for additional security.

40. Brand

export enum Brand {
  VISA = 'visa',
  MASTERCARD = 'mastercard',
  MADA = 'mada',
  UNKNOWN = 'unknown',
}
  • Description: Enum representing different card brands.
  • Enum Cases:
    • VISA: Visa card brand.
    • MASTERCARD: MasterCard brand.
    • MADA: Mada card brand.
    • UNKNOWN: Unknown card brand.

41. CardBrand

export class CardBrand {
  first6Digits: string;
  brand: Brand;
  brandIconUrl: string;

  constructor(params: { first6Digits: string; brand: Brand; brandIconUrl: string }) {
    this.first6Digits = params.first6Digits;
    this.brand = params.brand;
    this.brandIconUrl = params.brandIconUrl;
  }
}
  • Description: Represents the card brand information based on the first six digits.
  • Properties:
    • first6Digits: The first six digits of the card number.
    • brand: The brand of the card (Brand enum).
    • brandIconUrl: The URL of the brand’s icon.

.