Fix stripe. Remove fetching prices in getServerSideProps
This commit is contained in:
@@ -15,10 +15,7 @@ import {appearance} from '../../lib/utils/stripe-style'
|
||||
import CheckoutForm from './checkout-form'
|
||||
import StripeDialog from './stripe-dialog'
|
||||
|
||||
const stripePromise = loadStripe(
|
||||
process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY
|
||||
)
|
||||
|
||||
const STRIPE_PUBLIC_KEY = process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY
|
||||
const PAYPAL_ID = process.env.NEXT_PUBLIC_PAYPAL_DONATE_ID
|
||||
const LIBERAPAY_DONATE = process.env.NEXT_PUBLIC_LIBERAPAY_DONATE
|
||||
|
||||
@@ -55,7 +52,7 @@ function a11yProps(index) {
|
||||
}
|
||||
}
|
||||
|
||||
export default function PaymentMethod({isLoading, paymentMethod, setPaymentMethod, selectedMontant, setSelectedMontant, validMontant, setValidMontant, prices, paymentIntent, setClientSecret, setPaymentIntent, setIsLoading, setClientEmail, clientEmail, error, setError, clientSecret}) {
|
||||
export default function PaymentMethod({isLoading, paymentMethod, setPaymentMethod, selectedMontant, setSelectedMontant, validMontant, setValidMontant, paymentIntent, setClientSecret, setPaymentIntent, setIsLoading, setClientEmail, clientEmail, error, setError, clientSecret}) {
|
||||
const [open, setOpen] = useState(false)
|
||||
|
||||
const options = {
|
||||
@@ -114,7 +111,6 @@ export default function PaymentMethod({isLoading, paymentMethod, setPaymentMetho
|
||||
setSelectedMontant={setSelectedMontant}
|
||||
validMontant={validMontant}
|
||||
setValidMontant={setValidMontant}
|
||||
prices={prices}
|
||||
paymentIntent={paymentIntent}
|
||||
setClientSecret={setClientSecret}
|
||||
setPaymentIntent={setPaymentIntent}
|
||||
@@ -126,9 +122,8 @@ export default function PaymentMethod({isLoading, paymentMethod, setPaymentMetho
|
||||
isLoading={isLoading}
|
||||
>
|
||||
{clientSecret && validMontant && paymentMethod === 2 && (
|
||||
<Elements options={options} stripe={stripePromise}>
|
||||
<Elements options={options} stripe={loadStripe(STRIPE_PUBLIC_KEY)}>
|
||||
<CheckoutForm
|
||||
prices={prices}
|
||||
validMontant={validMontant}
|
||||
setError={setError}
|
||||
isLoading={isLoading}
|
||||
@@ -159,7 +154,6 @@ PaymentMethod.propTypes = {
|
||||
setSelectedMontant: PropTypes.func.isRequired,
|
||||
validMontant: PropTypes.string,
|
||||
setValidMontant: PropTypes.func.isRequired,
|
||||
prices: PropTypes.array.isRequired,
|
||||
paymentIntent: PropTypes.string,
|
||||
setClientSecret: PropTypes.func.isRequired,
|
||||
setPaymentIntent: PropTypes.func.isRequired,
|
||||
|
||||
Reference in New Issue
Block a user