I am trying to link stripe payment to a react native cli ecommerce app using the newly launched @stripe/stripe-react-native package but i am getting an error in android simulator while providing publishable key to stripe provider element
TypeError: null is not an object (evaluating '_NativeStripeSdk.default.initialise')
I tried to integrate the stripe package with another newly created react native cli app with just a normal template but still I am getting the same error. I have also checked the stripe publishable key with a react web app and it is working fine.
Here is my App.js
import {StripeProvider} from '@stripe/stripe-react-native';
import React from 'react';
import {StyleSheet, View, Text} from 'react-native';
const App = () => {
return (
<StripeProvider publishableKey="pk_test_51IeDvNS......">
<View>
<Text>Hello World...</Text>
</View>
</StripeProvider>
);
};
Here is the error I am getting
ERROR TypeError: null is not an object (evaluating '_NativeStripeSdk.default.initialise')
This error is located at:
in StripeProvider (at App.js:17)
in App (at renderApplication.js:45)
in RCTView (at View.js:34)
in View (at AppContainer.js:106)
in RCTView (at View.js:34)
in View (at AppContainer.js:132)
in AppContainer (at renderApplication.js:39)
Here is my package.json
{
"name": "amazonclone",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^1.15.4",
"@react-native-community/checkbox": "^0.5.7",
"@react-native-community/masked-view": "^0.1.11",
"@react-native-community/netinfo": "^6.0.0",
"@react-native-picker/picker": "^1.16.0",
"@react-navigation/bottom-tabs": "^5.11.11",
"@react-navigation/native": "^5.9.4",
"@react-navigation/stack": "^5.14.5",
"@stripe/stripe-react-native": "^0.1.2",
"amazon-cognito-identity-js": "^5.0.1",
"aws-amplify": "^4.0.2",
"aws-amplify-react-native": "^5.0.1",
"country-list": "^2.2.0",
"country-state-city": "^2.1.0",
"react": "17.0.2",
"react-native": "0.63",
"react-native-bouncy-checkbox": "^2.1.1",
"react-native-gesture-handler": "^1.10.3",
"react-native-inappbrowser-reborn": "^3.5.1",
"react-native-reanimated": "^2.1.0",
"react-native-safe-area-context": "^3.2.0",
"react-native-screens": "^3.2.0",
"react-native-vector-icons": "^8.1.0"
},
"devDependencies": {
"@babel/core": "^7.14.3",
"@babel/runtime": "^7.14.0",
"@react-native-community/eslint-config": "^2.0.0",
"@types/country-list": "^2.1.0",
"@types/jest": "^26.0.23",
"@types/react-native": "^0.64.5",
"@types/react-test-renderer": "^17.0.1",
"@types/zen-observable": "^0.8.2",
"babel-jest": "^26.6.3",
"eslint": "^7.26.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.66.0",
"react-test-renderer": "17.0.2",
"typescript": "^4.2.4"
},
"resolutions": {
"@types/react": "^17"
},
"jest": {
"preset": "react-native",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
}
}
error in android simulator
call stack in android simulator