diff --git a/.env.local.example b/.env.local.example index 632decde9..8ec1a117f 100644 --- a/.env.local.example +++ b/.env.local.example @@ -30,6 +30,10 @@ NEXTAUTH_SECRET=super-dev-secret GOOGLE_ID= GOOGLE_SECRET= +## Stripe ## +############## +STRIPE_PUBLIC_KEY= + ## Paypal ## ############## # using 'sb' as sandbox. no need to put real sandbox key if you don't plan to test requests with backend webhooks diff --git a/README.md b/README.md index 33abfb218..02b7ef04a 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,6 @@ Watch releases of this repository to be notified about future updates: ![Peek 2022-12-23 11-19](https://user-images.githubusercontent.com/893608/209308853-ddb8dfe8-1c42-4c18-be9c-4d55f8599d73.gif) - ## Contributors ✨ diff --git a/package.json b/package.json index a2e8921db..5d07672ea 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,8 @@ "@paypal/react-paypal-js": "^7.8.1", "@react-pdf/renderer": "^3.0.1", "@sentry/nextjs": "7.21.1", + "@stripe/react-stripe-js": "^1.16.1", + "@stripe/stripe-js": "^1.46.0", "@tanstack/react-query": "^4.16.1", "@tryghost/content-api": "^1.11.4", "axios": "0.21.4", diff --git a/src/components/donations/stripe/PaymentDetailsStripeForm.tsx b/src/components/donations/stripe/PaymentDetailsStripeForm.tsx new file mode 100644 index 000000000..ce9310288 --- /dev/null +++ b/src/components/donations/stripe/PaymentDetailsStripeForm.tsx @@ -0,0 +1,66 @@ +import getConfig from 'next/config' +import { Appearance, loadStripe } from '@stripe/stripe-js' +import { Elements, PaymentElement } from '@stripe/react-stripe-js' + +import theme from 'common/theme' +import { Box, BoxProps } from '@mui/material' +const { + publicRuntimeConfig: { STRIPE_PUBLIC_KEY }, +} = getConfig() + +const appearance: Appearance = { + theme: 'stripe', + variables: { + colorPrimary: theme.palette.primary.main, + colorBackground: theme.palette.background.paper, + colorText: theme.palette.text.primary, + colorDanger: theme.palette.error.main, + fontFamily: "Montserrat, 'Helvetica Neue', Helvetica, Arial, sans-serif", + fontSizeSm: theme.typography.pxToRem(12), + fontSizeBase: theme.typography.pxToRem(16), + fontSizeLg: theme.typography.pxToRem(18), + fontSizeXl: theme.typography.pxToRem(20), + spacingUnit: theme.spacing(0), + borderRadius: theme.borders.round, + focusBoxShadow: 'none', + focusOutline: `2px solid ${theme.palette.primary.main}`, + }, + rules: { + '.Input': { + boxShadow: 'none', + border: `1px solid ${theme.palette.grey[300]}`, + }, + '.Input:focus': { + border: 'none', + boxShadow: 'none', + }, + }, +} + +const stripePromise = loadStripe(STRIPE_PUBLIC_KEY) + +export type PaymentDetailsStripeFormProps = { + clientSecret: string + containerProps?: BoxProps +} +export default function PaymentDetailsStripeForm({ + clientSecret, + containerProps, +}: PaymentDetailsStripeFormProps) { + // const mutation = useCreatePaymentIntent({ amount: 100, currency: Currencies.BGN }) + // useEffect(() => { + // mutation.mutate() + // }, []) + return ( + + + + + + ) +} diff --git a/src/components/modal/DetailsModal.tsx b/src/components/modal/DetailsModal.tsx index 3fb3b7252..987538dbb 100644 --- a/src/components/modal/DetailsModal.tsx +++ b/src/components/modal/DetailsModal.tsx @@ -90,7 +90,6 @@ function DetailsModal() { ))} - {/* */}