Search code examples
react-nativestrapi

How use module @stripe/stripe-react-native in older react native project class component?


I want to use the latest stripe sdk @stripe/stripe-react-native in older react native project based in class component ? The doc stripe use the hooks,there is no example that used class component,So need help and thanks.


Solution

  • The problem was resolved when use "initStripe" provided by stripe module like this :

    1. Import :

    import { initStripe, createPaymentMethod, handleNextAction, } from '@stripe/stripe-react-native';
    

    2. Body of code:

    initStripe({ publishableKey: this.stripeKeyPublishable, merchantIdentifier: 'merchant.identifier', });