MoneyHash React Native SDK 3.x Migration Guide

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

Breaking Changes

Removed Apple Pay Method

proceedWithApplePay(...)Removed

This method has been removed in favor of a more modular and flexible Apple Pay integration:

// REMOVED
proceedWithApplePay(
  intentId: string,
  depositAmount: number,
  merchantIdentifier: string,
  currencyCode: string,
  countryCode: string,
  supportedNetworks?: string[],
  merchantCapabilities?: string[]
): Promise<IntentDetails>

✅ New Apple Pay Method

Apple Pay is now handled through a single, flexible method:

generateApplePayReceipt(...)

generateApplePayReceipt(params: {
  depositAmount: number;
  applePayData: ApplePayData;
}): Promise<NativePayReceipt>;

generateApplePayReceipt(params: {
  depositAmount: number;
  merchantIdentifier: string;
  currencyCode: string;
  countryCode: string;
  supportedNetworks?: string[];
  merchantCapabilities?: string[];
}): Promise<NativePayReceipt>;

You can use it in two ways:

Option 1: With ApplePayData (from NativePay)

const receipt = await moneyHashSDK.generateApplePayReceipt({
  depositAmount: 10.0,
  applePayData,
});

Option 2: With Explicit Fields

const receipt = await moneyHashSDK.generateApplePayReceipt({
  depositAmount: 10.0,
  merchantIdentifier: "merchant.com.example",
  currencyCode: "USD",
  countryCode: "US",
  supportedNetworks: ["visa", "masterCard"],
  merchantCapabilities: ["supports3DS"],
});

🆕 New Intent State: processing

A new intent state has been introduced to improve state tracking:

// New state returned in the intent lifecycle
type Processing = { type: 'processing' };

Purpose: Enables clearer tracking of intent processing transitions.

Make sure your switch-case or conditional logic can handle the new "processing" state.


⚙️ Card Form Configuration Updates

The card form component now supports a centralized configuration object that controls its behavior. Previously, the cardholder name field was marked as required using the required={true} prop on the SecureTextField. That approach is now deprecated.

✅ New Configuration Usage

Use the configuration prop on <SecureCardForm> to define global form behavior such as:

  • Whether the cardholder name is required
  • Whether the SDK should validate the card number format

Example (New Syntax):

<SecureCardForm
  ref={cardFormRef}
  onFormValidityChange={onFormValidityChange}
  configuration={{
    isCardHolderNameRequired: false,
    enableCardNumberValidation: true,
  }}
>
  <SecureTextField
    name="cardHolderName"
    placeholder="John Doe"
    style={({ isFocused, isError }) => [
      styles.input,
      isFocused && styles.inputFocused,
      isError && styles.inputError,
    ]}
    onChange={({ isValid }) => console.log('Cardholder valid:', isValid)}
  />
  <SecureTextField
    name="cardNumber"
    placeholder="#### #### #### ####"
    style={({ isFocused, isError }) => [
      styles.input,
      isFocused && styles.inputFocused,
      isError && styles.inputError,
    ]}
    onCardBrandChange={(brandInfo) => console.log('Card brand:', brandInfo)}
    onChange={({ isValid }) => console.log('Card number valid:', isValid)}
  />
  {/* ...additional fields... */}
</SecureCardForm>

Configuration Options

PropertyTypeDefaultDescription
isCardHolderNameRequiredbooleanfalseWhether the cardholder name field is required.
enableCardNumberValidationbooleantrueWhether to validate card number format.

🛠️

This approach ensures consistent behavior across the form and simplifies field configuration.


🔁 Migration Steps (Updated)

  1. Remove proceedWithApplePay and any references to it.
  2. Update your Apple Pay logic to use the new generateApplePayReceipt(params) flow.
  3. Handle the new processing intent state in your intent state logic.
  4. Replace required={true} on SecureTextField with a configuration object passed to SecureCardForm.