Next try
This commit is contained in:
@@ -2,24 +2,26 @@
|
|||||||
|
|
||||||
import {Elements} from "@stripe/react-stripe-js";
|
import {Elements} from "@stripe/react-stripe-js";
|
||||||
import {loadStripe} from "@stripe/stripe-js";
|
import {loadStripe} from "@stripe/stripe-js";
|
||||||
|
import React from "react";
|
||||||
import {useEffect} from "react";
|
import {useEffect} from "react";
|
||||||
|
|
||||||
const stripePromise = loadStripe("pk_test_51NzD5xFI67mXFum2XDMXiLu89SbCAMY5O0RnKjlU6XqyfboRVvFHI3f5OJHaxsrjjB7WqDYqN7Y3eF8mq3sF354F00l30L5GuJ");
|
const stripePromise = loadStripe("pk_test_51NzD5xFI67mXFum2XDMXiLu89SbCAMY5O0RnKjlU6XqyfboRVvFHI3f5OJHaxsrjjB7WqDYqN7Y3eF8mq3sF354F00l30L5GuJ");
|
||||||
|
|
||||||
export default function PricingTable() {
|
export default function PricingTable() {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log("ENV VARIABLES", process.env.NEXT_PUBLIC_STRIPE_PRICING_TABLE, process.env.NEXT_PUBLIC_STRIPE_KEY);
|
const script = document.createElement("script");
|
||||||
|
script.src = "https://js.stripe.com/v3/pricing-table.js";
|
||||||
|
script.async = true;
|
||||||
|
document.body.appendChild(script);
|
||||||
|
return () => {
|
||||||
|
document.body.removeChild(script);
|
||||||
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
return React.createElement("stripe-pricing-table", {
|
||||||
return (
|
id: process.env.NEXT_PUBLIC_STRIPE_PRICING_TABLE,
|
||||||
<Elements stripe={stripePromise}>
|
"pricing-table-id": process.env.NEXT_PUBLIC_STRIPE_PRICING_TABLE,
|
||||||
<stripe-pricing-table
|
"publishable-key": process.env.NEXT_PUBLIC_STRIPE_KEY,
|
||||||
id="pricing"
|
});
|
||||||
pricing-table-id={process.env.NEXT_PUBLIC_STRIPE_PRICING_TABLE}
|
|
||||||
publishable-key={process.env.NEXT_PUBLIC_STRIPE_KEY}
|
|
||||||
/>
|
|
||||||
</Elements>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If using TypeScript, add the following snippet to your file as well.
|
// If using TypeScript, add the following snippet to your file as well.
|
||||||
|
|||||||
Reference in New Issue
Block a user