#louay-tate-_api

1 messages ¡ Page 1 of 1 (latest)

sour ventureBOT
#

👋 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.

queen grail
#

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});
});

pearl matrix
#

Where do you see this error? on the checkout page or the API response?

sour ventureBOT
strong hollow
#

Hey! Taking over for my colleague. Let me catch up.