diff options
| author | Wes Bos <wesbos@gmail.com> | 2017-08-08 22:09:05 -0400 |
|---|---|---|
| committer | Wes Bos <wesbos@gmail.com> | 2017-08-08 22:09:05 -0400 |
| commit | 222ab374d53a206332b1ab51c7c43f6d5dc7a31e (patch) | |
| tree | 2b446d96bfc6c7efab07f3d0fbb84d96ecb1253b /pages/buy.js | |
yep
Diffstat (limited to 'pages/buy.js')
| -rw-r--r-- | pages/buy.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/pages/buy.js b/pages/buy.js new file mode 100644 index 0000000..e3037fb --- /dev/null +++ b/pages/buy.js @@ -0,0 +1,44 @@ +import { Component } from 'react'; +import withData from '../lib/withData'; +import StripeCheckout from 'react-stripe-checkout'; + +class TakeMoney extends React.Component { + onToken = async (token) => { + console.log(token); + // now that we have the token, create an "order" + + // const res = await fetch('/save-stripe-token', { + // method: 'POST', + // body: JSON.stringify(token), + // }) + // const data = await res.json(); + // console.log(data); + } + + // ... + + render() { + return ( + // ... + <StripeCheckout + token={this.onToken} + stripeKey="pk_lclTtThFp8CnO3QtEZSd8HA9mFUps" + amount={1000000} // cents + currency="USD" + /> + ) + } +} + +class Buy extends Component { + render() { + return ( + <div> + <p>Buy</p> + <TakeMoney></TakeMoney> + </div> + ) + } +} + +export default withData(Buy); |
