#bala-Subscription

1 messages · Page 1 of 1 (latest)

glacial garnet
#

Hi there, can you elaborate more on pass the price money using redirect checkout API and create sessions API ? Also can you share with me the code?

obtuse zealot
#

const item = {
// price: "price_1LA7xZSBJFbPZu8A6GtPM5ah",
price: "20",
quantity: 1
};

const checkoutOptions = {
lineItems: [
item
],
mode: "payment",
successUrl: ${window.location.origin}/success,
cancelUrl: ${window.location.origin}/cancel
};

const redirectToCheckout = async () => {
console.log("redirectToCheckout");
const stripe = await getStripe();
// const session = await stripe.checkout.sessions.create({
// success_url: ${window.location.origin}/success,
// cancel_url: ${window.location.origin}/cancel,
// line_items: [
// {price: '20', quantity: 1},
// ],
// mode: 'payment',
// });

const { error } = await stripe.redirectToCheckout(checkoutOptions);
console.log("Stripe checkout error", error);

};

#

@stripe/react-stripe-js version = 1.9.0@stripe/stripe-js version = 1.32.0

glacial garnet
obtuse zealot
#

okay, thank you for your answer.

#

from the beginning, I tried checkout mode to subscription, but that params also not working, that's why I tried payment mode.