Skip to content

rn_apple_pay_not_supported #246

@Deepali-Rai

Description

@Deepali-Rai

Describe the issue

Our team is trying to integrate Apple Pay into our React Native app using the RN Plugin for In-App Payments SDK, but we keep running into this error: [Error: Something went wrong. Please contact the developer of this application and provide them with this error code: rn_apple_pay_not_supported] whenever we call SQIPApplePay.requestApplePayNonce.

To Reproduce

Steps to reproduce the issue.

  1. Initialize the SDK
  2. Initialize Apple Pay
  3. call await SQIPApplePay.requestApplePayNonce

Here the piece of code that reproduce the issue.

useEffect(() => {
  const initializeDigitalWallet = async () => {
    let digitalWalletEnabled = false;

    if (Platform.OS === 'ios') {
      try {
        await SQIPApplePay.initializeApplePay('merchant.FMApplePay');
        digitalWalletEnabled = await SQIPApplePay.canUseApplePay();
      } catch (error) {
        console.error('Error initializing Apple Pay:', error);
      }
    } else if (Platform.OS === 'android') {
      // Add Android-specific logic here
    }

    setCanUseDigitalWallet(digitalWalletEnabled);
  };

  initializeDigitalWallet();
}, []);

const onApplePayNonceRequestSuccess = async (cardDetails) => {
  try {
    // Process the card nonce details (e.g., take payment)
    // await chargeCard(cardDetails);

    // Close the Apple Pay sheet successfully
    await SQIPApplePay.completeApplePayAuthorization(true);
  } catch (ex) {
    // Handle card nonce processing failure
    await SQIPApplePay.completeApplePayAuthorization(false, ex.message);
  }
};

const onApplePayNonceRequestFailure = async (errorInfo) => {
  // Handle the error and close the Apple Pay sheet
  console.log(errorInfo, '!!!!!!!!!!!!err')
  await SQIPApplePay.completeApplePayAuthorization(false, errorInfo.message);
};

const onApplePayEntryComplete = () => {
  // Handle the event when the Apple Pay sheet is closed
  console.log('Apple Pay sheet closed');
};

 const onStartDigitalWallet = async () => {
  if (Platform.OS === 'ios') {
    const applePayConfig = {
      price: '1.00',
      summaryLabel: 'Test Item',
      countryCode: 'US',
      currencyCode: 'USD',
    };

    try {
      await SQIPApplePay.requestApplePayNonce(
        applePayConfig,
        onApplePayNonceRequestSuccess,
        onApplePayNonceRequestFailure,
        onApplePayEntryComplete,
      );
    } catch (ex) {
      console.error('Error requesting Apple Pay nonce:', ex);
    }
  } else if (Platform.OS === 'android') {
    // Add Android-specific logic here
  }
};


Expected behavior

The Apple Pay finish and return me the valid token.



**Environment (please complete the following information):**

- platform: iOS
- In-App Payments Plugin version: [e.g. 1.7.6]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions