dev stripe checks

This commit is contained in:
ntr 2019-09-03 11:29:05 +10:00
parent fbb7e58f3c
commit 7603497372
2 changed files with 22 additions and 7 deletions

View File

@ -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 = () => (
<Provider store={store}>
<StripeProvider apiKey="pk_live_fQGrL1uWww2ot8W1G7vTySAv004ygmnMXq">
<StripeProvider apiKey={stripeKey()}>
<Mnml />
</StripeProvider>
</Provider>

View File

@ -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,
});
}