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

Update stripe handler with multiple stripe accounts #106

Merged
merged 1 commit into from
Apr 24, 2018

Conversation

piuccio
Copy link
Contributor

@piuccio piuccio commented Apr 24, 2018

Possibly connected to #103
I have multiple stripe accounts (different keys) but in order to change account the user needs to navigate away from the page that contains stripe-checkout.

In my use case the first page load calls componentDidMount which sets the correct api key. Requests to stripe at this point work correctly.
Then the user changes page (go to settings to change stripe account) and goes back to the previous payment screen, but now the stripe api key is different. However since the previous component was already unmounted, react calls again componentDidMount instead of componentDidUpdate so internally the api key stays the same and my requests fail.

I've added a call to updateStripeHandler which itself will check if the this.props.reconfigureOnUpdate is true and if so, reconfigure the already loaded handler.

@mediavrog
Copy link

LGTM!
LGTM

👍 👎

@azmenak azmenak merged commit 6a84539 into azmenak:master Apr 24, 2018
@piuccio piuccio deleted the multiple-accounts branch April 30, 2018 02:00
@piuccio
Copy link
Contributor Author

piuccio commented Apr 30, 2018

@azmenak any plan to release this to npm?

1 similar comment
@piuccio
Copy link
Contributor Author

piuccio commented Sep 12, 2018

@azmenak any plan to release this to npm?

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

Successfully merging this pull request may close these issues.

3 participants