Models
This document provides a detailed explanation of each model within the MoneyHash SDK for Flutter. These models represent various aspects of payment intents, methods, transactions, and more.
1. CardFieldState
CardFieldState
class CardFieldState {
final bool isValid;
final String? errorMessage;
final int length;
}
- 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.
2. CardFieldType
CardFieldType
enum CardFieldType {
cardNumber,
cardHolderName,
expiryYear,
expiryMonth,
cvv
}
- Description: Enum representing different types of card fields used in forms.
- Enum Cases:
cardNumber
: Represents the card number field.cardHolderName
: Represents the cardholder's name field.expiryYear
: Represents the expiration year field.expiryMonth
: Represents the expiration month field.cvv
: Represents the CVV field (Card Verification Value).
3. CardTokenData
CardTokenData
class CardTokenData {
final String? bin;
final String? brand;
final String? cardHolderName;
final String? country;
final String? expiryMonth;
final String? expiryYear;
final String? issuer;
final String? last4;
final String? logo;
final List<String>? paymentMethods;
final bool? 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
: Boolean indicating if CVV is required for transactions.
4. FeeItem
FeeItem
class FeeItem {
final Map<Language, String> title;
final String value;
final DiscountItem? discount;
FeeItem({
required this.title,
required this.value,
this.discount,
});
}
- Description: Represents a fee item associated with an intent, which may include a discount.
- Properties:
title
: A map of titles by language, describing the fee.value
: The value of the fee.discount
: An optionalDiscountItem
associated with the fee.
5. Language
Language
enum Language {
arabic,
english,
french,
}
- Description: Enum representing different languages supported by the SDK.
- Enum Cases:
arabic
: Arabic language.english
: English language.french
: French language.
6. InputField
InputField
class InputField {
final InputFieldType type;
final String? name;
String? value;
final String? label;
final int? maxLength;
final bool isRequired;
final List<OptionItem>? optionsList;
final Map<String, List<OptionItem>>? optionsMap;
final String? hint;
final int? minLength;
final bool readOnly;
final String? dependsOn;
}
- Description: Represents a field in a form used for collecting user input.
- Properties:
type
: Type of the input field (e.g., text, email).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.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.
7. InputFieldType
InputFieldType
enum InputFieldType {
text,
email,
phoneNumber,
date,
number,
select,
}
- Description: Enum representing the type of an input field.
- Enum Cases:
text
: Standard text input field.email
: Email input field.phoneNumber
: Phone number input field.date
: Date input field.number
: Numeric input field.select
: Dropdown or select input field.
8. OptionItem
OptionItem
class OptionItem {
final String label;
final String 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.
9. IntentStatus
IntentStatus
enum IntentStatus {
processed,
unProcessed,
timeExpired,
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.
10. IntentDetails
IntentDetails
class IntentDetails {
final String? selectedMethod;
final IntentData? intent;
final double? walletBalance;
final TransactionData? transaction;
final IntentStateDetails? intentState;
final List<ProductItem>? productItems;
}
- Description: Provides detailed information about an intent.
- Properties:
selectedMethod
: The payment method selected for the intent.intent
: TheIntentData
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.
11. TransactionData
TransactionData
class TransactionData {
final String? billingData;
final double? amount;
final List<String>? externalActionMessage;
final String? amountCurrency;
final String? id;
final String? methodName;
final String? method;
final String? createdDate;
final String? status;
final String? customFields;
final String? providerTransactionFields;
final String? 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.
12. IntentData
IntentData
class IntentData {
final AmountData? amount;
final String? secret;
final String? expirationDate;
final bool? isLive;
final String? id;
final IntentStatus? status;
final List<FeeItem>? fees;
final String? totalDiscount;
final String? subtotalAmount;
}
- 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
).fees
: A list of fees applied to the intent (FeeItem
).totalDiscount
: The total discount applied to the intent.subtotalAmount
: The subtotal amount before any discounts or fees.
13. AmountData
AmountData
class AmountData {
final String? value;
final double? formatted;
final String? currency;
final double? 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.
14. CustomerBalance
CustomerBalance
class CustomerBalance {
final double? balance;
final String? id;
final String? icon;
final bool? isSelected;
final MethodType? 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
).
15. PaymentMethod
PaymentMethod
class PaymentMethod {
final String? id;
final String? title;
final bool? isSelected;
final bool? confirmationRequired;
final List<String>? icons;
final MethodType? type;
final List<InputField>? 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
).
16. PayoutMethod
PayoutMethod
class PayoutMethod {
final String? id;
final String? title;
final bool? isSelected;
final bool? confirmationRequired;
final List<String>? icons;
final MethodType? type;
final List<InputField>? 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
).
17. ExpressMethod
ExpressMethod
class ExpressMethod {
final String? id;
final String? title;
final bool? isSelected;
final bool? confirmationRequired;
final List<String>? icons;
final MethodType? type;
final List<InputField>? 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
).
18. SavedCard
SavedCard
class SavedCard {
final String? id;
final String? brand;
final String? last4;
final String? expiryMonth;
final String? expiryYear;
final String? country;
final String? logo;
final bool? requireCvv;
final CvvConfig? cvvConfig;
final MethodType? type;
final String? 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).
19. CvvConfig
CvvConfig
class CvvConfig {
final int? digitsCount;
}
- Description: Configuration details for entering the CVV during a transaction.
- Properties:
digitsCount
: The number of digits required for the CVV.
20. IntentMethods
IntentMethods
class IntentMethods {
final List<CustomerBalance>? customerBalances;
final List<PaymentMethod>? paymentMethods;
final List<ExpressMethod>? expressMethods;
final List<SavedCard>? savedCards;
final List<PayoutMethod>? 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.
21. IntentResult
IntentResult
class IntentResult {
final IntentMethods? methods;
final IntentDetails? 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
).
22. IntentStateDetails
IntentStateDetails
sealed class IntentStateDetails {}
- Description: Represents different states an intent can be in.
MethodSelection
MethodSelection
class MethodSelection extends IntentStateDetails {
final IntentMethods methods;
MethodSelection({
required this.methods,
});
}
- Description: Represents the state where the user selects a payment method.
- Properties:
methods
: The available methods for selection (IntentMethods
).
IntentForm
IntentForm
class IntentForm extends IntentStateDetails {}
- Description: Represents the state where the MoneyHash form is rendered.
- Properties: None.
IntentProcessed
IntentProcessed
class IntentProcessed extends IntentStateDetails {}
- Description: Represents the state where the intent has been processed successfully.
- Properties: None.
TransactionWaitingUserAction
TransactionWaitingUserAction
class TransactionWaitingUserAction extends IntentStateDetails {}
- Description: Represents the state where the transaction is waiting for user action.
- Properties: None.
TransactionFailed
TransactionFailed
class TransactionFailed extends IntentStateDetails {
final IntentMethods? recommendedMethods;
TransactionFailed({
this.recommendedMethods,
});
}
- Description: Represents the state where the transaction has failed.
- Properties:
recommendedMethods
: Optional recommended methods for retrying the transaction (IntentMethods
).
Expired
Expired
class Expired extends IntentStateDetails {}
- Description: Represents the state where the intent has expired.
- Properties: None.
Closed
Closed
class Closed extends IntentStateDetails {}
- Description: Represents the state where the intent has been closed.
- Properties: None.
FormFields
FormFields
class FormFields extends IntentStateDetails {
final TokenizeCardInfo? tokenizeCardInfo;
final List<InputField>? billingFields;
final List<InputField>? shippingFields;
FormFields({
this.tokenizeCardInfo,
this.billingFields,
this.shippingFields,
});
}
- Description: Represents the state where form fields are being filled out.
- Properties:
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
UrlToRender
class UrlToRender extends IntentStateDetails {
final String? url;
final RenderStrategy? renderStrategy;
UrlToRender({
this.url,
this.renderStrategy,
});
}
- Description: Represents the state where a URL needs to be rendered or redirected.
- Properties:
url
: The URL to be rendered.renderStrategy
: The strategy for rendering the URL (RenderStrategy
).
SavedCardCVV
SavedCardCVV
class SavedCardCVV extends IntentStateDetails {
final InputField cvvField;
final CardTokenData? cardTokenData;
SavedCardCVV({
required this.cvvField,
this.cardTokenData,
});
}
- Description: Represents the state where a saved card's CVV is being entered.
- Properties:
cvvField
: The CVV input field required (InputField
).cardTokenData
: Token data for the card (CardTokenData
).
NativePay
NativePay
class NativePay extends IntentStateDetails {
final NativePayData? nativePayData;
NativePay({
this.nativePayData,
});
}
- Description: Represents the use of native payment methods like Apple Pay.
- Properties:
nativePayData
: Data needed to process a native pay transaction (NativePayData
).
CardIntentSuccessful
CardIntentSuccessful
class CardIntentSuccessful extends IntentStateDetails {}
- Description: Represents the state where a card intent has been processed successfully.
- Properties: None.
CardIntentFailed
CardIntentFailed
class CardIntentFailed extends IntentStateDetails {}
- Description: Represents the state where a card intent has failed.
- Properties: None.
23. MethodType
MethodType
enum MethodType {
expressMethod,
customerBalance,
savedCard,
paymentMethod,
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.
24. MethodMetaData
MethodMetaData
class MethodMetaData {
final String? cvv;
}
- Description: Contains metadata related to a payment method, such as CVV.
- Properties:
cvv
: The CVV code for a card.
25. ApplePayData
ApplePayData
class ApplePayData extends NativePayData {
final String? countryCode;
final String? merchantId;
final String? currencyCode;
final double? amount;
final List<String>? supportedNetworks;
}
- Description: Contains data necessary for configuring an Apple Pay transaction.
- Properties:
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).
26. ProductItem
ProductItem
class ProductItem {
final String? name;
final String? type;
final String? amount;
final String? category;
final int? quantity;
final String? description;
final String? subcategory;
final String? 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.
27. RenderStrategy
RenderStrategy
enum RenderStrategy {
iframe,
popupIframe,
redirect,
none,
}
- Description: Enum representing different strategies for rendering web content within the SDK.
- Enum Cases:
iframe
: Content is rendered within an iframe.popupIframe
: Content is rendered within a popup iframe.redirect
: Content is rendered via a URL redirect.none
: No rendering strategy is applied.
28. SaveCardCheckbox
SaveCardCheckbox
class SaveCardCheckbox {
final bool? mandatory;
final bool? 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.
29. TokenizeCardInfo
TokenizeCardInfo
class TokenizeCardInfo {
final String? accessToken;
final bool? isLive;
final bool? saveCard;
final SaveCardCheckbox? 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
).
30. VaultData
VaultData
class VaultData {
final String? firstSixDigits;
final String? lastFourDigits;
final String? cardScheme;
final String? cardHolderName;
final String? expiryYear;
final String? expiryMonth;
final bool? isLive;
final String? accessToken;
final String? cardToken;
final String? cvv;
final bool? saveCard;
final String? 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.
31. FeesData
FeesData
class FeesData {
final String? amount;
final List<FeeItem>? fees;
FeesData({
this.amount,
this.fees,
});
}
- Description: Represents the fees data associated with the intent.
- Properties:
amount
: The total amount of the fees.fees
: A list ofFeeItem
objects representing individual fees.
32. DiscountItem
DiscountItem
class DiscountItem {
final Map<Language, String>? title;
final DiscountType? type;
final String? value;
DiscountItem({
this.title,
this.type,
this.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
), which can be eitheramount
orpercentage
.value
: The value of the discount.
33. DiscountType
DiscountType
enum DiscountType {
amount,
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.
34. DiscountData
DiscountData
class DiscountData {
final DiscountItem? discount;
final String? amount;
DiscountData({
this.discount,
this.amount,
});
}
- Description: Represents the data related to a discount applied to the intent.
- Properties:
discount
: TheDiscountItem
associated with the intent.amount
: The amount after the discount is applied.
35. Brand
Brand
enum Brand {
visa,
mastercard,
mada,
unknown,
}
- Description: Enum representing different card brands.
- Enum Cases:
visa
: Visa card brand.mastercard
: MasterCard brand.mada
: Mada card brand.unknown
: Unknown card brand.
36. CardBrand
CardBrand
class CardBrand {
final String first6Digits;
final Brand brand;
final String 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.
37. GetMethodsParams
GetMethodsParams
class GetMethodsParams {
String? intentId;
IntentType? intentType;
String? currency;
String? customer;
String? flowId;
double? amount;
}
- Description: Represents the parameters needed to retrieve payment methods.
- Properties:
intentId
: The ID of the intent.intentType
: The type of intent (IntentType
).currency
: The currency code (e.g., "USD").customer
: The customer identifier.flowId
: The flow identifier.amount
: The amount involved.
38. IntentType
IntentType
enum IntentType {
payment,
payout,
}
- Description: Enum representing the type of intent.
- Enum Cases:
payment
: Represents a payment intent.payout
: Represents a payout intent.
39. MHExceptionType
MHExceptionType
enum MHExceptionType {
network,
unknown,
cardValidation,
cancelled,
applePayTransactionFailed,
notCompatibleWithApplePay,
}
- Description: Enum representing different types of exceptions that can occur in the SDK.
- Enum Cases:
network
: Network-related error.unknown
: An unknown error.cardValidation
: Error related to card validation.cancelled
: The operation was cancelled.applePayTransactionFailed
: Apple Pay transaction failed.notCompatibleWithApplePay
: Device is not compatible with Apple Pay.
40. ErrorDetail
ErrorDetail
class ErrorDetail {
final String key;
final String message;
}
- Description: Represents detailed information about an error.
- Properties:
key
: The error key or code.message
: The error message.
41. LogLevel
LogLevel
enum LogLevel {
verbose,
debug,
info,
warn,
error,
assertion,
}
- 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.
42. GooglePayEnvironment
GooglePayEnvironment
enum GooglePayEnvironment {
test,
production,
}
- Description: Enum representing the environment configuration for Google Pay.
- Enum Cases:
test
: Indicates that Google Pay is operating in a test environment.production
: Indicates that Google Pay is operating in a live production environment.
43. AllowedCards
AllowedCards
enum AllowedCards {
amex,
discover,
interac,
jcb,
mastercard,
visa,
}
- Description: Enum representing the allowed card networks for Google Pay transactions.
- Enum Cases:
amex
: American Express card network.discover
: Discover card network.interac
: Interac card network.jcb
: Japan Credit Bureau card network.mastercard
: MasterCard card network.visa
: Visa card network.
44. SupportedMethods
SupportedMethods
enum SupportedMethods {
pan_only,
cryptogram_3ds,
}
- Description: Enum representing the supported authentication methods for Google Pay.
- Enum Cases:
pan_only
: Transactions using the Primary Account Number without cryptographic verification.cryptogram_3ds
: Transactions using 3D Secure cryptographic authentication.
45. NativeGooglePayConfig
NativeGooglePayConfig
class NativeGooglePayConfig {
final GooglePayEnvironment environment;
final List<AllowedCards> allowedCards;
final List<SupportedMethods> supportedMethods;
NativeGooglePayConfig({
required this.environment,
required this.allowedCards,
required this.supportedMethods,
});
}
- Description: Configuration settings for initializing Google Pay within the SDK.
- Properties:
environment
: The environment setting for Google Pay (GooglePayEnvironment
).allowedCards
: A list of allowed card networks for transactions (AllowedCards
).supportedMethods
: A list of supported authentication methods (SupportedMethods
).
46. GooglePayData
GooglePayData
class GooglePayData extends NativePayData {
final String? countryCode;
final String? merchantId;
final String? merchantName;
final String? currencyCode;
final double? amount;
final String? gateway;
final String? gatewayMerchantId;
GooglePayData({
this.countryCode,
this.merchantId,
this.merchantName,
this.currencyCode,
this.amount,
this.gateway,
this.gatewayMerchantId,
});
}
- Description: Contains data necessary for configuring a Google Pay transaction.
- Inheritance: Extends
NativePayData
. - Properties:
countryCode
: The ISO 3166-1 alpha-2 country code where the transaction is processed (e.g., "US").merchantId
: The unique identifier assigned to the merchant by Google Pay.merchantName
: The display name of the merchant.currencyCode
: The ISO 4217 currency code for the transaction (e.g., "USD").amount
: The total amount for the transaction.gateway
: The payment gateway identifier.gatewayMerchantId
: The merchant identifier assigned by the payment gateway.
Updated about 1 month ago