MoneyHash Flutter SDK 3.x Migration Guide

This document outlines the breaking changes, new features, and the migration steps required to upgrade your Flutter integration to version 3.x.x

Breaking Changes

Removed Apple Pay Method

proceedWithApplePay(...)Removed

The following method was removed in favor of a more modular Apple Pay flow:

Future<IntentDetails?> proceedWithApplePay(
  String intentId,
  double depositAmount,
  String merchantIdentifier,
  String currencyCode,
  String countryCode, {
  List<String>? supportedNetworks,
  List<String>? merchantCapabilities,
})

generateApplePayReceipt(...)Removed

Future<NativePayReceipt?> generateApplePayReceipt(
  double depositAmount,
  String merchantIdentifier,
  String currencyCode,
  String countryCode, {
  List<String>? supportedNetworks,
  List<String>? merchantCapabilities,
})

New Apple Pay Method

Apple Pay is now handled through a single generateApplePayReceipt method with flexible parameterization via ApplePayReceiptParams.

generateApplePayReceipt(...) using ApplePayReceiptParams

Future<NativePayReceipt?> generateApplePayReceipt(
  ApplePayReceiptParams params,
)

You can use it in two ways:

Option 1: With ApplePayData (preconfigured)

var applePayData = ApplePayData(...)
final receipt = await moneyHash.generateApplePayReceipt(
  ApplePayReceiptParams.withApplePayData(
    10.0,
    applePayData,
  ),
);

Option 2: With explicit Apple Pay fields

final receipt = await moneyHash.generateApplePayReceipt(
  ApplePayReceiptParams.withCustomData(
    depositAmount: 10.0,
    merchantIdentifier: 'merchant.com.example',
    currencyCode: 'USD',
    countryCode: 'US',
    supportedNetworks: ['visa', 'masterCard'],
    merchantCapabilities: ['supports3DS'],
  ),
);

This approach allows full customization while keeping your code clean and extensible.


New Intent State: Processing

The IntentStateDetails union now includes a new state (Processing):

class Processing extends IntentStateDetails {}

Purpose: Allows better tracking of intermediate processing states in your payment flow.

Be sure to update any switch or when logic on IntentStateDetails to handle the Processing state appropriately.


🧪 Card Number Validation Control

You now have control over whether the SDK validates card numbers using CardFormConfiguration.

Example:

final config = CardFormConfiguration(
  isCardHolderNameRequired: false,
  enableCardNumberValidation: true,
);

Configuration options:

  • true (default): Enables card number validation.
  • false: Disables validation, allowing you to handle it independently

Benefits: Provides flexibility for integrators who prefer to defer validation or implement custom validation logic.


Migration Steps

  1. Remove proceedWithApplePay and any references to it.
  2. Update your Apple Pay flow to use the new generateApplePayReceipt method with ApplePayReceiptParams.
  3. Handle the new Processing intent state in your state handling logic.
  4. Configure card form validation using the new CardFormConfiguration.