Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to create the instance while using @chargebee/chargebee-js-react-wrapper #132

Open
mcarry1 opened this issue Mar 1, 2023 · 1 comment

Comments

@mcarry1
Copy link

mcarry1 commented Mar 1, 2023

I am using @chargebee/chargebee-js-react-wrapper in react project i added below code in index.html

<script src="https://js.chargebee.com/v2/chargebee.js"> window.ChargeBee.init({ site: 'carestack-test', publishableKey: 'test_Dwrb01yx7K5Jy7EBAwxOJHp8f0vIQGcw', }); </script>

and using the CardComponent in different file but i am getting Cannot read properties of undefined (reading 'init')

image

@damyco
Copy link

damyco commented Nov 23, 2023

You are probably trying to initialise chargebee before the script it's loaded.
Try loading the script first and then use useEffect on mount only to init the instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants