Amwal Pay SDK Flutter

A Flutter SDK for integrating Amwal Pay payment solutions into your mobile apps, providing secure, seamless, and customizable payment experiences.

Features

  • Multi-Platform Support: Android, iOS, Web, macOS, Windows, Linux
  • WASM Compatibility: Full support for WebAssembly compilation (Flutter 3.32.0+)
  • Payment Methods: Card payments, wallet payments, QR payments
  • Security: Built-in security features and encryption
  • Customizable UI: Flexible and customizable payment interfaces with bottom sheet design and color theming

WASM Compatibility

This SDK is fully compatible with Flutter's WebAssembly (WASM) compilation for web platforms. WASM provides:

  • Better Performance: Near-native execution speed in web browsers
  • Smaller Bundle Size: Optimized compilation for web deployment
  • Modern Web Standards: Leverages the latest web technologies

WASM Requirements

  • Flutter 3.32.0 or higher
  • Dart 3.8.0 or higher
  • Modern web browsers with WASM support

Building for WASM

# Build with WASM support
flutter build web --wasm

# Build with JavaScript fallback
flutter build web

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  amwal_pay_sdk: ^1.1.26

Usage

import 'package:amwal_pay_sdk/amwal_pay_sdk.dart';

// Initialize the SDK
await AmwalPaySdk.instance.initSdk(
  settings: AmwalSdkSettings(
    merchantId: 'your_merchant_id',
    terminalId: 'your_terminal_id',
    amount: '100.00',
    currency: 'OMR',
    transactionId: 'unique_transaction_id',
    sessionToken: 'your_session_token',
    environment: Environment.PROD,
    merchantReference: 'optional_merchant_reference', // Optional: Merchant reference for transaction tracking
  ),
);

Optional Parameters

  • merchantReference: An optional merchant reference string that can be used to associate the payment with a specific order or reference number in your system. This field is passed through to the Execute endpoints when provided.

Optimizing App Size (Important)

When integrating the Amwal Pay Native SDKs into your app, you must apply the following configurations to avoid drastically inflating your production app size by 100-200MB.

Android

By default, Flutter builds native libraries (.so files) for multiple architectures, including x86_64 (emulator-only). If you build a universal APK without filtering, your app size will increase unnecessarily.

The amwalsdk library module already restricts its own native code to production architectures (arm64-v8a and armeabi-v7a) via abiFilters in its build.gradle.kts. This prevents the SDK itself from contributing emulator-only slices to your app.

Additionally, in your app's app/build.gradle (Kotlin DSL: app/build.gradle.kts), you should also apply abiFilters to ensure the final APK only includes supported architectures:

// Kotlin DSL (build.gradle.kts)
android {
    defaultConfig {
        ndk {
            // Exclude x86/x86_64 (emulator-only) from production releases
            abiFilters += listOf("arm64-v8a", "armeabi-v7a")
        }
    }
}
// Groovy DSL (build.gradle)
android {
    defaultConfig {
        ndk {
            // Exclude x86/x86_64 (emulator-only) from production releases
            abiFilters 'arm64-v8a', 'armeabi-v7a'
        }
    }
}

Note: For Play Store distribution, prefer Android App Bundles (AAB) — Google Play will automatically deliver only the architectures required by each device, eliminating the need for manual abiFilters.

iOS

The SDK podspec defaults to the Release subspec to ensure production apps remain small. However, the Release subspec does not support the iOS Simulator.

To test on the Simulator during development, you must map the Debug subspec to your project's Debug configuration in your Podfile:

target 'YourAppTarget' do
  # Link Debug subspec for Debug builds (Supports Simulator)
  pod 'amwalsdk/Debug', :configurations => ['Debug']
  # Link Release subspec for Release builds (Optimized, physical device only)
  pod 'amwalsdk/Release', :configurations => ['Release']
end

Platform Support

Platform Status Notes
Android ✅ Full Support Native Android implementation
iOS ✅ Full Support Native iOS implementation
Web (JavaScript) ✅ Full Support Traditional web compilation
Web (WASM) ✅ Full Support WebAssembly compilation
macOS ✅ Full Support Native macOS implementation
Windows ✅ Full Support Native Windows implementation
Linux ✅ Full Support Native Linux implementation

Web Platform

The web platform supports both JavaScript and WASM compilation modes:

  • JavaScript Mode: Traditional compilation for broader browser compatibility
  • WASM Mode: Modern compilation for better performance and smaller bundles

Web-Specific Features

  • Responsive design for all screen sizes
  • Touch and mouse input support
  • Progressive Web App (PWA) capabilities
  • Cross-browser compatibility

Contributing

Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support and questions:

Additional Configuration

The SDK supports additionValues parameter for passing custom key-value pairs that can be used for various SDK functionalities including UI customization and payment flow control.

Default Addition Values

The SDK automatically provides default values:

  • merchantIdentifier: "merchant.applepay.amwalpay" (used for Apple Pay configuration)

Available Configuration Options

You can customize the SDK behavior using the following additionValues keys:

UI Customization

  • useBottomSheetDesign: 'true' | 'false' (default: 'false')

    • Controls the payment screen design
    • 'true': Uses the newer bottom sheet design (v2) - slides up from bottom covering 90% of screen
    • 'false': Uses the original full-screen design
  • primaryColor: Hex color string (e.g., '#FF5733')

    • Sets the primary theme color for the SDK UI
    • Default: #7F22FF (purple)
  • secondaryColor: Hex color string (e.g., '#33FF57')

    • Sets the secondary theme color for the SDK UI
    • Default: #37658c (blue)

Payment Flow

  • ignoreReceipt: 'true' | 'false' (default: 'false')

    • Controls whether to show the receipt screen after transaction
    • 'true': Skips the receipt display
    • 'false': Shows the receipt screen
  • merchantIdentifier: String (default: 'merchant.applepay.amwalpay')

    • Apple Pay merchant identifier for iOS

Usage Examples

import 'package:amwal_pay_sdk/amwal_pay_sdk.dart';

// Using default additionValues (automatically applied)
final settings = AmwalSdkSettings(
  environment: Environment.UAT,
  sessionToken: sessionToken,
  currency: 'OMR',
  amount: '100.0',
  merchantId: 'your_merchant_id',
  terminalId: 'your_terminal_id',
  transactionType: TransactionType.cardWallet,
  // additionValues will automatically include merchantIdentifier
);

// Using custom additionValues with bottom sheet design and colors
final customSettings = AmwalSdkSettings(
  environment: Environment.UAT,
  sessionToken: sessionToken,
  currency: 'OMR',
  amount: '100.0',
  merchantId: 'your_merchant_id',
  terminalId: 'your_terminal_id',
  transactionType: TransactionType.cardWallet,
  additionValues: {
    'useBottomSheetDesign': 'true',
    'primaryColor': '#FF5733',
    'secondaryColor': '#33FF57',
    'ignoreReceipt': 'false',
    'merchantIdentifier': 'merchant.custom.identifier'
  },
);

// Minimal configuration with just bottom sheet design
final minimalSettings = AmwalSdkSettings(
  environment: Environment.UAT,
  sessionToken: sessionToken,
  currency: 'OMR',
  amount: '100.0',
  merchantId: 'your_merchant_id',
  terminalId: 'your_terminal_id',
  transactionType: TransactionType.cardWallet,
  additionValues: {
    'useBottomSheetDesign': 'true'
  },
);

// Initialize and start payment
await AmwalPaySdk.instance.initSdk(settings: customSettings);

Note: All boolean values should be passed as strings ('true' or 'false'). Custom additionValues will be merged with defaults, with custom values taking precedence.

Bottom Sheet Design

When useBottomSheetDesign is set to 'true', the payment screen will:

  • Slide up from the bottom of the screen
  • Cover approximately 90% of the screen height
  • Automatically expand when keyboard is open
  • Provide a modern, modal-style user experience
  • Include rounded corners at the top (24px radius)
  • Allow dismissal by dragging down (if enabled)

This design is particularly useful for maintaining context with the parent application while providing a focused payment experience.

Libraries

amwal_pay_sdk
A Flutter SDK for integrating Amwal Pay payment solutions into your mobile apps. This library provides secure, seamless, and customizable payment experiences.
amwal_pay_sdk_flutter
A Flutter SDK for integrating Amwal Pay payment solutions into your mobile apps. This library provides secure, seamless, and customizable payment experiences.
amwal_sdk_settings/amwal_sdk_setting_container
amwal_sdk_settings/amwal_sdk_settings
amwal_sdk_web
core/apiview/api_view
core/apiview/state_mapper
core/base_repository/base_repository
core/base_response/base_response
core/base_state/base_cubit_state
core/base_view_cubit/base_cubit
core/constants/sdk_constants
core/enums/transaction_type
core/loader_mixin
core/logger/amwal_logger
core/logger/example
core/logger/firestore_logger
core/logger/logar
core/logger/logar_injector
core/logger/logar_migration_helper
core/logger/logger
core/merchant_store/merchant_store
core/networking/constants
core/networking/custom_log_interceptor
core/networking/dio_client
core/networking/encryption_util
core/networking/mockup_interceptor
core/networking/network_service
core/networking/network_state
core/networking/secure_hash_interceptor
core/networking/token_interceptor
core/resources/assets/app_assets_paths
core/resources/color/amwal_theme_manager
core/resources/color/colors
core/tablayout/tab_layout_cubit
core/tablayout/tab_layout_generic_widget
core/tooltip_widget
core/ui/accepted_payment_methods_widget
core/ui/alert_dialog/alert_dialog
core/ui/amount_with_logo_widget
core/ui/amountcurrencywidget/amount_currency_widget
core/ui/amountcurrencywidget/amount_currency_widget_cubit
core/ui/amountcurrencywidget/decimal_text_input_formatter
core/ui/app_dialog
core/ui/buttons/app_button
core/ui/buttons/app_main_button
core/ui/cardinfoform/card_form_inputs_formatter
core/ui/cardinfoform/card_info_form_widget
core/ui/cardinfoform/card_info_form_widget_v2
core/ui/cardinfoform/card_type
core/ui/cardinfoform/card_utils
core/ui/count_down_dialog/count_down_dialog
core/ui/directional_widget/directional_widget
core/ui/error_dialog
core/ui/failed_animation_dialog
core/ui/inputfields/date_picker_field
core/ui/inputfields/input_field_widget
core/ui/inputfields/phone_input_field
core/ui/listpicker/bottom_select_list
core/ui/loading_dialog
core/ui/sale_card_feature_common_widgets
core/ui/success_animation_dialog
core/ui/transactiondialog/ios_receipt_sharing_helper
core/ui/transactiondialog/receipt_sharing_helper
core/ui/transactiondialog/transaction
core/ui/transactiondialog/transaction_detail_widget
core/ui/transactiondialog/transaction_details_settings
core/ui/transactiondialog/transaction_dialog_action_buttons
core/ui/transactiondialog/transaction_status_dialog
core/usecase/i_use_case
features/card/amwal_salebycard_sdk
features/card/cubit/sale_by_card_contact_less_cubit
features/card/cubit/sale_by_card_manual_cubit
features/card/data/models/request/customer_token_request
features/card/data/models/request/delete_customer_token_request
features/card/data/models/request/purchase_request
features/card/data/models/response/card_info
features/card/data/models/response/customer_token_response
features/card/data/models/response/delete_customer_token_response
features/card/data/models/response/purchase_response
features/card/data/repository/sale_by_card_repository
features/card/dependency/injector
features/card/domain/repository/sale_by_card_repo
features/card/domain/sale_by_card_constants
features/card/domain/use_case/delete_customer_token_use_case
features/card/domain/use_case/get_customer_token_use_case
features/card/domain/use_case/pay_with_token_use_case
features/card/domain/use_case/purchase_apple_samsung_pay
features/card/domain/use_case/purchase_otp_step_one_use_case
features/card/domain/use_case/purchase_otp_step_two_use_case
features/card/domain/use_case/purchase_use_case
features/card/module/sale_by_card_module
features/card/presentation/app
features/card/presentation/sale_by_card_contact_less_screen
features/card/presentation/sale_by_card_manual_screen
features/card/presentation/sale_by_card_manual_screen_v2
features/card/presentation/sale_by_card_screen
features/card/presentation/thrree_ds_web_view_page
features/card/presentation/widgets/otp_dialog
features/card/presentation/widgets/select_card_bottom_sheet
features/card/presentation/widgets/select_card_bottom_sheet_v2
features/card/state/sale_by_wallet_state
features/card/transaction_manager/amwal_card_transaction_manager
features/card/transaction_manager/i_card_transaction_manager
features/card/transaction_manager/in_app_card_transaction_manager
features/card/transaction_manager/in_app_card_transaction_manager_v2
features/card/transaction_manager/transaction_util_dialog
features/currency_field/cubit/currency_cubit
features/currency_field/data/models/request/currency_request
features/currency_field/data/models/response/currency_response
features/currency_field/data/repository/currency_repository
features/currency_field/domain/currency_constants
features/currency_field/domain/repository/currency_repository
features/currency_field/domain/use_case/currency_use_case
features/currency_field/module/currency_binds
features/currency_field/presentation/currency_field
features/digital_wallet/constants/digital_wallet_constants
features/digital_wallet/constants/digital_wallet_translations
features/digital_wallet/cubit/sale_by_digital_wallet_cubit
features/digital_wallet/model/digital_wallet_response
features/digital_wallet/module/sale_by_apple_pay_module
features/digital_wallet/presentation/digital_wallet_screen
features/payment_argument
features/receipt/receipt_handler
features/receipt/receipt_handler_v2
features/transaction/data/models/request/transaction_operation_request
features/transaction/data/models/response/merchant_name_response
features/transaction/data/models/response/one_transaction_response
features/transaction/data/models/response/transaction_operation_response
features/transaction/data/repository/transaction_repository_impl
features/transaction/domain/repository/transaction_repository
features/transaction/domain/use_case/get_transaction_by_id
features/transaction/module/transaction_module
features/transaction/util
features/wallet/amwal_salebywallet_sdk
A Flutter SDK for integrating Amwal Pay payment solutions into your mobile apps. This library provides secure, seamless, and customizable payment experiences.
features/wallet/cubit/sale_by_qr_cubit
features/wallet/cubit/sale_by_wallet_cubit
features/wallet/cubit/sale_by_wallet_pay_cubit
features/wallet/cubit/sale_by_wallet_verify_cubit
features/wallet/data/models/request/dynamic_qr_request
features/wallet/data/models/request/payment_request
features/wallet/data/models/request/sale_by_wallet_request
features/wallet/data/models/request/verification_request
features/wallet/data/models/response/qr_response
features/wallet/data/models/response/sale_by_wallet_response
features/wallet/data/models/response/verify_customer_response
features/wallet/data/models/response/wallet_pay_response
features/wallet/data/repository/sale_by_wallet_repo_imp
features/wallet/data/sale_by_wallet_constant
features/wallet/dependency/injector
features/wallet/domain/sale_by_wallet_repository
features/wallet/domain/use_case/pay_with_alias_use_case
features/wallet/domain/use_case/pay_with_mobile_use_case
features/wallet/domain/use_case/pay_with_qr_use_case
features/wallet/domain/use_case/verify_customer_use_case
features/wallet/module/sale_by_wallet_module
features/wallet/presentation/app
features/wallet/presentation/screen/sale_by_wallet_paying_options
features/wallet/presentation/screen/sale_by_wallet_paying_options_v2
features/wallet/presentation/screen/sale_by_wallet_screen
features/wallet/presentation/widgets/alias_pay_widget
features/wallet/presentation/widgets/phone_pay_widget
features/wallet/presentation/widgets/sale_action_buttons
features/wallet/presentation/widgets/sale_by_wallet_mixins/sale_by_wallet_action_mixin
features/wallet/presentation/widgets/sale_by_wallet_mixins/sale_by_wallet_pay_mixin
features/wallet/presentation/widgets/sale_by_wallet_mixins/sale_by_wallet_verify_mixin
features/wallet/presentation/widgets/scan_qr_to_pay
features/wallet/state/sale_by_wallet_state
localization/app_localizations
localization/app_localizations_delegate
localization/app_localizations_setup
localization/locale_utils
navigator/sdk_navigator
presentation/amwal_pay_bottom_sheet
presentation/amwal_pay_screen
presentation/amwal_pay_screen_v2
presentation/color/colors
presentation/sdk_arguments
sdk_builder/network_service_builder
sdk_builder/sdk_builder
service/nfc_manager