diff --git a/client/src/app.jsx b/client/src/app.jsx index ad0db010..ab17520c 100644 --- a/client/src/app.jsx +++ b/client/src/app.jsx @@ -13,6 +13,11 @@ const registerEvents = require('./events'); const Mnml = require('./components/mnml'); +function stripeKey() { + if (window.location.host === 'mnml.gg') return 'pk_live_fQGrL1uWww2ot8W1G7vTySAv004ygmnMXq'; + return 'pk_test_Cb49tTqTXpzk7nEmlGzRrNJg00AU0aNZDj'; +} + // Redux Store const store = createStore( combineReducers(reducers), @@ -30,7 +35,7 @@ document.fonts.load('16pt "Jura"').then(() => { const App = () => ( - + diff --git a/client/src/components/stripe.buttons.jsx b/client/src/components/stripe.buttons.jsx index 83076a9d..ef72c5a9 100644 --- a/client/src/components/stripe.buttons.jsx +++ b/client/src/components/stripe.buttons.jsx @@ -1,6 +1,16 @@ const preact = require('preact'); const { injectStripe } = require('react-stripe-elements'); +function subPlan() { + if (window.location.host === 'mnml.gg') return 'plan_Fjdtsd4i7aVLe1'; + return 'prod_FWSA8RoyMMV3st'; +} + +function bitsSku() { + if (window.location.host === 'mnml.gg') return 'sku_Fjdu7zOy3sLGc5'; + return 'sku_FjuNxONdWewjH2'; +} + function BitsBtn(args) { const { stripe, @@ -8,18 +18,18 @@ function BitsBtn(args) { } = args; function subscribeClick() { stripe.redirectToCheckout({ - items: [{ plan: 'plan_Fjdtsd4i7aVLe1', quantity: 1 }], - successUrl: 'https://mnml.gg', - cancelUrl: 'https://mnml.gg', + items: [{ plan: subPlan(), quantity: 1 }], + successUrl: window.location.origin, + cancelUrl: window.location.origin, clientReferenceId: account.id, }); } function bitsClick() { stripe.redirectToCheckout({ - items: [{ sku: 'sku_Fjdu7zOy3sLGc5', quantity: 1 }], - successUrl: 'https://mnml.gg', - cancelUrl: 'https://mnml.gg', + items: [{ sku: bitsSku(), quantity: 1 }], + successUrl: window.location.origin, + cancelUrl: window.location.origin, clientReferenceId: account.id, }); }