Skip to content

TapPay configuration does not update with new appId 、appKey #25

@george-eucare

Description

@george-eucare

Description:
in my React Native project. initially sets up TapPay using certain credentials (e.g., appId = 123, appKey = "aaa").
Later, after fetching new credentials from our API (e.g., appId = 456, appKey = "bbb"),
we call the setup method again via our custom hook, but the new values do not take effect. The getDirectPayPrime() call still uses the old configuration until the app is completely closed and reopened.

//useTapPay.ts
import { NativeModules } from 'react-native';
const { TapPay } = NativeModules;

export const useTapPay = ({ appId, appKey }: useTapPayParams) => {
  const { setup } = TapPay;

  useEffect(() => {
    if (appId && appKey) {
      console.log('Setting up TapPay with:', appId, appKey); 
      setup(appId, appKey, TAP_PAY_ENV);
    }
  }, [appId, appKey, setup]);

  return { TapPay };
};


// App.tsx
... 
const { TapPay } = useTapPay(...);
const result = await TapPay.getDirectPayPrime();
console.log('🚀 result:', result); // still old TapPay object  until the app is completely closed and reopened.

env:
Xcode: 16.2
react-native:0.72
device : iphone13、14、15
TapPay SDK:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions