Created
June 19, 2020 14:57
-
-
Save SimonHoiberg/01197bb1564072a01081e12c87cac161 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const CheckoutForm = () => { | |
// Include these hooks: | |
const stripe = useStripe(); | |
const elements = useElements(); | |
const [nameInput, setNameInput] = useState(''); | |
const [retry, setRetry] = useState(!!localStorage.getItem('invoice_retry')); | |
const handleSubmitPayment = async () => { | |
// Not implemented yet | |
}; | |
const handleRetryPayment = async () => { | |
// Not implemented yet | |
}; | |
const buttonAction = retry ? handleRetryPayment : handleSubmitPayment; | |
return ( | |
<div> | |
<input | |
placeholder='Name on card' | |
value={nameInput} | |
onChange={(e) => setNameInput(e.currentTarget.value)} | |
/> | |
<CardNumberElement /> | |
<CardExpiryElement /> | |
<CardCvcElement /> | |
<button onClick={buttonAction}></button> | |
</div> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment