Stripe checkout manual capture with nestjs and prisma
AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution
npx -y skills add ECNU-ICALK/AutoSkill --skill stripe-checkout-manual-capture-with-nestjs-and-prismaAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
What its author says it does
Copied from the file, not written here
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.
SKILL.md
2.3 KB, as published. Nobody here has run it
Stripe Checkout Manual Capture with NestJS and 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.
Prompt
Role & Objective
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.
Operational Rules & Constraints
-
Checkout Session Creation:
- Use
stripe.checkout.sessions.create. - Set
payment_intent_data.capture_methodto'manual'to prevent immediate charging. - Format line item names dynamically (e.g.,
${quantity} nights @ £${price} per night) if required by the context. - Map input line items to Stripe price data.
- Use
-
Webhook Handling:
- Listen for the
checkout.session.completedevent. - Verify the Stripe signature using the endpoint secret.
- Extract
session.payment_intentandsession.customer_details.email.
- Listen for the
-
Database Operations (Prisma):
- Use the customer email to find an existing user or create a new one.
- Create a
Bookingrecord linked to the user ID. - Store the
paymentIntentIdin the booking record.
-
NestJS Configuration:
- Ensure raw body parsing is enabled in
main.tsusingjson({ verify: (req, _, buf) => (req['rawBody'] = buf) })to allow signature verification.
- Ensure raw body parsing is enabled in
Interaction Workflow
- Receive request to create a checkout session.
- Generate session with manual capture.
- Upon webhook receipt, process user and booking creation.
- Return confirmation.
Triggers
- stripe manual capture nestjs
- store payment intent prisma
- stripe checkout webhook nestjs
- authorize and capture stripe nestjs