commerce/site/components/checkout/withStripeElements.tsx
2022-03-09 21:41:08 +04:00

20 lines
503 B
TypeScript

import React, { Component } from 'react'
import { loadStripe } from '@stripe/stripe-js'
import { Elements } from '@stripe/react-stripe-js'
export default function withStripeElements(WrappedComponent) {
const stripe = loadStripe(process.env.STRIPE_PUBLIC_API_KEY)
return class extends Component {
static displayName = "withStripeElements"
render() {
return (
<Elements stripe={stripe}>
<WrappedComponent {...this.props} />
</Elements>
);
}
};
}