I want to send some data from one page to another when the payment is successful.
const item = {
price: "testt_stripe",
quantity: 1
};
const checkoutOptions = {
lineItems: [item],
mode: "subscription",
successUrl: `${window.location.origin}/payment`,
cancelUrl: `${window.location.origin}/cancel`,
};
const redirectToCheckout = async () => {
// Stripe checkout
setLoading(true);
const stripe = await getStripe();
const { error } = await stripe.redirectToCheckout(checkoutOptions);
if (error) setStripeError(error.message);
setLoading(false);
};
button
onClick={redirectToCheckout}
Now I want to send some data from component A which contains the button and redirectToCheckout to component B which is /payment page. I am new to react js and trying to understand how can I do that. Thank you