#louay-tate-_api
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/1318864168887123979
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
oops
const express = require('express');
const Stripe = require('stripe');
const app = express();
// Configureer je Stripe-secret key
const stripe = Stripe('');
// Middleware om JSON-requests te verwerken
app.use(express.json());
// Route om een Checkout-session te maken
app.post('/create-checkout-session', async (req, res) => {
try {
const { amount, currency } = req.body;
// Maak een nieuwe Checkout-session aan
const session = await stripe.checkout.sessions.create({
payment_method_types: ['ideal'], // Alleen iDEAL als betaalmethode
line_items: [
{
price_data: {
currency: currency,
product_data: {
name: 'Betaling voor service', // Pas aan naar je productbeschrijving
},
unit_amount: amount,
},
quantity: 1,
},
],
mode: 'payment',
success_url: 'https://your-website.com/success', // Vervang door jouw succes-URL
cancel_url: 'https://your-website.com/cancel', // Vervang door jouw annuleer-URL
});
// Stuur de sessionId terug naar de client
res.json({ sessionId: session.id });
} catch (error) {
console.error('Fout bij het maken van de Checkout-session:', error);
res.status(500).json({ error: 'Kon geen Checkout-session maken.' });
}
});
// Start de server
const PORT = 24221;
app.listen(PORT, () => {
console.log(Server is running on port ${PORT});
});
Where do you see this error? on the checkout page or the API response?
checkout page
Hey! Taking over for my colleague. Let me catch up.