#patrick_error
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1240538830776438834
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
It looks like you mixed up the Checkout Session and Payment Intent integration
Elements only supports Payment Intent (pi_xxx), but not Checkout Session (cs_xxx)
I'd recommend checking Subscription integration using Payment Intent here: https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=web&ui=elements
There is no client_secret from the Checkout Session
app.post("/create-checkout-session", async (req, res) => {
try {
const session = await stripe.checkout.sessions.create({
line_items: [
{
price: "price_1Oz8hhKJh7RBv6HQdoJtBPXP",
quantity: 1,
},
],
mode: "subscription",
ui_mode: "embedded",
redirect_on_completion: "never",
});
res.send({
sessionId: session.id,
clientSecret: session.client_secret,
});
} catch (error) {
return res.status(400).send({ error: { message: error.message } });
}
});
so I can't use the clientSecret from stripe.checkout.sessions.create to cardNumberElement?
Checkout Session is Stripe hosted payment page and it can't be used with CardNumberElement
Checkout Session doesn't have client_secret for Element since the payment is expected to be done in Stripe page
CardNumberElement only supports client_secret from subscription = await stripe.subscriptions.create()
Thanks for your reply. I'll try embedded mode again
No problem! Happy to help ๐
Can I customize the embeded view? Only keep the card information and subscription button?
I'm afraid embedded Checkout Session is not customisable
It seems that the workload on the server side is unavoidable. Thanks again for your reply.