The team is now working on the WordPress Interactivity API. This unblocks the same UX Frontity framework enabled but directly in WordPress Core, fully compatible with the new Site Editor.
I am trying to integrate stripe as my site’s checkout process but i am having few issues
need 2 HOCs (connect,injectStripe), tried to use recompose but its not working and throwing this error
Uncaught Error: It looks like you are trying to inject Stripe context outside of an Elements context.
Please be sure the component that calls createSource or createToken is within an component.
Stripe requires a script to be added to index.html but i cant find it.
I appreciate your responses.
Thanks!
luisherranz2
I’ve just tested connect with recompose and it works fine:
By taking a look at the react-stripe-elements issues it looks like more a problem of react-stripe-elements with SSR:
And use state.frontity.rendering === "csr" to render the react-stripe-elements components only on the browser:
import { Elements } from 'react-stripe-elements';
const MyStoreCheckout = ({ state }) =>
state.frontity.rendering === "csr"
// Render this in the browser
? <Elements> <InjectedCheckoutForm /> </Elements>
// Render this in the server
: <CheckoutPlaceholder />;
Use CheckoutPlaceholder to render something in the server. Please note that the placeholder will be shown in the browser as well, until React is loaded. Once React loads, rendering becomes "csr" and the react checkout is shown.
Let me know if this approach works for you.
aeyzazkhan3
Hi @luisherranz, Thanks for such a detailed reply. with recompose i was able to make the things working, i just had to reorder the components in recompose to make them work.
now i need to import some CSS files but seems like they are not being rendered, may i know how to make them work?