Skip to content

Feat/64 social session checkout#76

Open
WilliamH141 wants to merge 4 commits into
mainfrom
feat/64-social-session-checkout
Open

Feat/64 social session checkout#76
WilliamH141 wants to merge 4 commits into
mainfrom
feat/64-social-session-checkout

Conversation

@WilliamH141

@WilliamH141 WilliamH141 commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Description

Adds POST /api/social-sessions/:id/checkout, creates a pending registration + Stripe Checkout Session for paid social sessions. Cleans up the pending row if Stripe fails. Adds stripeCheckoutSessionId to SocialSessionRegistrations.

Closes #64

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • Manual testing (requires screenshots or videos)

Tested manually, see breakdown below.

Setup:

  • Stripe test key in .env
  • Existing paid social session (monday social session, memberPrice 14, nonMemberPrice 3)

Test 1: Happy path (guest checkout)

curl -X POST http://localhost:3000/api/social-sessions/69fef1c4e93c220e9c10e060/checkout \
  -H "Content-Type: application/json" \
  -d '{"guestName":"Test Guest","guestEmail":"guest@example.com"}'

Response: { url, registrationId: 6a1ce3547bf243fea37ba4e4 }

Stripe Checkout rendered with NZ$3.00 (non-member price) + guest@example.com pre-filled:

image

Payload row created with paymentStatus: pending, amountPaid: 3, stripeCheckoutSessionId populated:

image

Test 2: Free session rejected

Created a free session (no memberPrice / nonMemberPrice), then ran:

curl -X POST http://localhost:3000/api/social-sessions/6a1ce9397bf243fea37ba5c9/checkout \
  -H "Content-Type: application/json" \
  -d '{"guestName":"Test Guest","guestEmail":"guest@example.com"}'

Response: {"error":"This session is free — register directly without checkout."}

image

No new registration row created (4 rows, all for monday social session):

image

Test 3: Stripe failure cleans up

Temporarily set STRIPE_SECRET_KEY=sk_test_bogus in .env, restarted dev, then ran:

curl -X POST http://localhost:3000/api/social-sessions/69fef1c4e93c220e9c10e060/checkout \
  -H "Content-Type: application/json" \
  -d '{"guestName":"Test Guest 2","guestEmail":"guest2@example.com"}'

Response: {"error":"Failed to create checkout session"}

image

No leftover pending row for Test Guest 2, cleanup logic deleted it after Stripe failed:

image

Checklist before requesting a review

  • My code follows the style guidelines of this project
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation if needed
  • I've requested a review from another team member

@WilliamH141 WilliamH141 force-pushed the feat/64-social-session-checkout branch from b8d12a3 to fbaff4d Compare June 1, 2026 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BACKEND] Stripe Checkout Session creation endpoint for paid social sessions

1 participant