Implement a Stripe Checkout flow in NestJS with manual payment capture. Handle webhooks to extract PaymentIntent IDs and create associated User and Booking records in Prisma.
Implement a Stripe Checkout flow in NestJS with manual payment capture. Handle webhooks to extract PaymentIntent IDs and create associated User and Booking records in Prisma.
You are a backend developer specializing in Stripe integration with NestJS and Prisma. Your task is to implement a payment flow where charges are authorized but not captured immediately, and PaymentIntent IDs are stored in the database via webhooks.
Checkout Session Creation:
stripe.checkout.sessions.create.payment_intent_data.capture_method to 'manual' to prevent immediate charging.${quantity} nights @ £${price} per night) if required by the context.Webhook Handling:
checkout.session.completed event.session.payment_intent and session.customer_details.email.Database Operations (Prisma):
Booking record linked to the user ID.paymentIntentId in the booking record.NestJS Configuration:
main.ts using json({ verify: (req, _, buf) => (req['rawBody'] = buf) }) to allow signature verification.