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

Switch between chargebee instances #65

Open
atefrihane opened this issue Aug 17, 2021 · 4 comments
Open

Switch between chargebee instances #65

atefrihane opened this issue Aug 17, 2021 · 4 comments

Comments

@atefrihane
Copy link

atefrihane commented Aug 17, 2021

Hi everyone,
I've just started using Chargebee in a project and I'm having multiple chargebee accounts!
I'm using VueJs

I would like to initialize chargebee depending on user selection!
is there any way to remove the current instance and recreate it?

I tried

   delete window.Chargebee.getInstance();

then

window.Chargebee.init({
  site: "site-name", // your test site
  domain: "https://mybilling.acme.com" // this is an optional parameter.
  // Use this, if custom domain is enabled for your site
})

I get chargebee.ts:19 Chargebee.js has been already initialized

Is there any way to do it ?

@cb-samuel
Copy link

Hello @atefrihane this is Samuel from the Chargebee engineering team. Hope this message finds you well! :)

With Chargebee.js code, the initialization is done after cbInstance init() with the respective Chargebee site credentials, So in the current config irrespective of the wrapper(Vue/React), removing and reinitializing an active instance is not possible.

A better approach would be to identify the site in context and then initialize Chargebee.

Having said that, I have taken this up for discussion with my team and post that I will be adding this to our Product enhancement pipeline.

Feel free to write to [email protected] for any queries related to Chargebee.

@pareshbalar
Copy link

pareshbalar commented Jun 22, 2022

Hi, @cb-samuel any update on this?

@kathawala
Copy link

@cb-samuel would also like to know if this is possible now. We want to use the test-site conditionally, based on the user who is logged in. So on login / logout we want to re-initialize the Chargebee instance or remove and replace with a new initialization. Thanks

@abdullateefakorede
Copy link

@cb-samuel Please any update with this?

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

5 participants