Closed smakosh closed 2 years ago
Underneath: https://stripe.com/docs/payments/accept-a-payment-synchronously?html-or-react=react
yarn add @formspree/react
import { useForm, FormspreeProvider, CardElement } from '@formspree/react'; // document that this is just passing CardElement through const useOptions = () => { const options = useMemo( () => ({ style: { base: { color: "#424770", letterSpacing: "0.025em", fontFamily: "Source Code Pro, monospace", "::placeholder": { color: "#aab7c4" } }, invalid: { color: "#9e2146" } } }), [] ); return options; }; function SignupForm() { const options = useOptions(); const [state, handleSubmit] = useForm('hashid'); return ( <form onSubmit={handleSubmit}> <label htmlFor="email">Email</label> <input id="email" type="email" name="email" /> <CardElement options={options} /> <button disabled={state.submitting}>Pay</button> </form> ) } const App = () => ( <FormspreeProvider stripePK="asdfklajsdf"> <SignupForm /> </FormspreeProvider> )
https://github.com/stripe/stripe-js/issues/43#issuecomment-643840075
Handle fetching the price from Formspree
So that the user can fetch the price that has been set from Formspree in case they wanted to control that from one place rather than hard coding it.
Support different Stripe payment methods, not only CC
Use Turborepo and group all Formspree TypeScript libraries in one monorepo with examples/docs folders
Build is failing because @formspree/core PR needs to be merged first to upgrade the package, so that the new types will be accessible here
@formspree/core
Is this good to be merged?
What's new?
Demo usage:
Underneath: https://stripe.com/docs/payments/accept-a-payment-synchronously?html-or-react=react
Use cases:
Takeaways:
Next steps:
Propositions
Handle fetching the price from Formspree
Support different Stripe payment methods, not only CC
Use Turborepo and group all Formspree TypeScript libraries in one monorepo with examples/docs folders