Skip to content

Payment Testing Checklist - Phase 5 Week 2 Day 5

Date: November 5, 2025 Purpose: Comprehensive payment flow testing before beta launch Status: Ready for Testing


Overview

This document provides a step-by-step testing checklist for CodeSlick's Stripe integration. Complete all tests to ensure the payment system works correctly before inviting beta users.

Stripe Test Mode: Use test card 4242 4242 4242 4242 for all tests


Pre-Testing Setup

1. Environment Variables Check

Verify all Stripe environment variables are configured:

# Check .env.local has:
 STRIPE_SECRET_KEY (starts with sk_test_)
 STRIPE_WEBHOOK_SECRET (starts with whsec_)
 STRIPE_PRICE_ID_TEAM (starts with price_)
 STRIPE_PRICE_ID_ENTERPRISE (starts with price_)

Command:

grep STRIPE .env.local

2. Development Server Running

npm run dev

Verify server is running at http://localhost:3000

3. Stripe CLI Installed (For Webhook Testing)

stripe listen --forward-to localhost:3000/api/billing/webhook

This forwards Stripe webhooks to your local development server.


Test Suite 1: Free → Team Plan Upgrade

Test 1.1: Create Free Team

Steps: 1. ✅ Sign in with GitHub OAuth 2. ✅ Install GitHub App on a repository 3. ✅ Verify team auto-created with plan: 'free' 4. ✅ Navigate to team settings → Billing tab

Expected Results: - Team created successfully - Database: teams.plan = 'free' - Database: teams.stripeCustomerId = NULL - Billing tab shows "Free Plan" badge - "Upgrade to Team Plan" button visible

Verification Query:

SELECT id, name, plan, stripe_customer_id
FROM teams
WHERE id = 'YOUR_TEAM_ID';


Test 1.2: Initiate Checkout

Steps: 1. ✅ Click "Upgrade to Team Plan" button in Billing tab 2. ✅ Verify redirected to Stripe Checkout page

Expected Results: - Stripe Checkout page loads - Product: "CodeSlick TEAM" - Price: €99.00/month displayed - Payment form shows

URL Pattern: https://checkout.stripe.com/c/pay/cs_test_...


Test 1.3: Complete Payment (Success Flow)

Steps: 1. ✅ Enter test card: 4242 4242 4242 4242 2. ✅ Expiry: Any future date (e.g., 12/25) 3. ✅ CVC: Any 3 digits (e.g., 123) 4. ✅ Name: Test User 5. ✅ Email: your-email@example.com 6. ✅ Click "Subscribe"

Expected Results: - Payment processing animation - Redirected back to CodeSlick (/teams/[id]?session_id=cs_test_...) - Success message displayed: "Subscription activated successfully!"

Browser Console Check:

// Should see redirect with session_id parameter
location.href
// Example: http://localhost:3000/teams/abc123?session_id=cs_test_xyz


Test 1.4: Verify Database Updates

Wait: 5-10 seconds for webhook processing

Verification Queries:

-- 1. Check team updated
SELECT id, name, plan, stripe_customer_id
FROM teams
WHERE id = 'YOUR_TEAM_ID';
-- Expected: plan = 'team', stripe_customer_id populated

-- 2. Check subscription created
SELECT
  id,
  team_id,
  stripe_subscription_id,
  stripe_customer_id,
  stripe_price_id,
  status,
  current_period_end
FROM subscriptions
WHERE team_id = 'YOUR_TEAM_ID';
-- Expected: status = 'active', all fields populated

-- 3. Check invoice created
SELECT
  id,
  team_id,
  stripe_invoice_id,
  amount,
  currency,
  status,
  paid_at
FROM invoices
WHERE team_id = 'YOUR_TEAM_ID'
ORDER BY created_at DESC;
-- Expected: amount = 9900 (€99.00), status = 'paid'

Test 1.5: Verify UI Updates

Steps: 1. ✅ Navigate to team settings → Billing tab 2. ✅ Check plan badge 3. ✅ Check subscription details

Expected Results: - Badge shows "Team Plan" (green/blue badge) - Subscription details visible: - Status: Active - Next billing date: [30 days from now] - Amount: €99.00/month - "Manage Billing" button visible - "Upgrade to Team Plan" button hidden


Test 1.6: Verify Member Limit Increase

Steps: 1. ✅ Navigate to Settings → Members tab 2. ✅ Try to invite 5 members (Free plan limit was 1)

Expected Results: - Can invite up to 5 members (Team plan limit) - Invitation limit check passes - No "Upgrade to invite more members" message

API Test:

curl -X GET http://localhost:3000/api/teams/YOUR_TEAM_ID/members/limit

Expected response:

{
  "current": 1,
  "limit": 5,
  "plan": "team",
  "canAddMore": true,
  "remainingSlots": 4
}


Test Suite 2: Stripe Customer Portal

Test 2.1: Access Customer Portal

Steps: 1. ✅ Navigate to team settings → Billing tab 2. ✅ Click "Manage Billing" button

Expected Results: - Redirected to Stripe Customer Portal - URL: https://billing.stripe.com/p/session/test_... - Portal shows: - Current plan: CodeSlick TEAM - Payment method - Invoices list - Cancel subscription option


Test 2.2: Update Payment Method

Steps: 1. ✅ In Customer Portal, click "Update payment method" 2. ✅ Enter new test card: 5555 5555 5555 4444 (Mastercard test card) 3. ✅ Submit

Expected Results: - Payment method updated successfully - Stripe dashboard shows new payment method - Next invoice will use new card

Verification: Check Stripe Dashboard → Customers → Your customer → Payment methods


Test 2.3: View Invoices

Steps: 1. ✅ In Customer Portal, navigate to "Invoices" section 2. ✅ Verify initial invoice appears 3. ✅ Click "View invoice" or "Download PDF"

Expected Results: - Invoice #1 visible - Amount: €99.00 - Status: Paid - PDF download works


Test 2.4: Cancel Subscription

Steps: 1. ✅ In Customer Portal, click "Cancel subscription" 2. ✅ Select cancellation reason (optional) 3. ✅ Confirm cancellation

Expected Results: - Cancellation confirmation shown - Subscription marked as "Cancels on [end date]" - Access continues until end of billing period

Wait: 5-10 seconds for webhook processing

Verification Query:

SELECT
  stripe_subscription_id,
  status,
  cancel_at_period_end,
  current_period_end
FROM subscriptions
WHERE team_id = 'YOUR_TEAM_ID';
-- Expected: cancel_at_period_end = true, status = 'active'

UI Check: - Navigate back to CodeSlick → Settings → Billing - Should show warning: "Subscription will cancel on [date]" - "Reactivate Subscription" button visible


Test 2.5: Reactivate Subscription

Steps: 1. ✅ In CodeSlick Billing tab, click "Reactivate Subscription" 2. ✅ Confirm reactivation

Expected Results: - Webhook received: customer.subscription.updated - Database updated: cancel_at_period_end = false - UI shows "Active" status again - No cancellation warning


Test Suite 3: Webhook Handling

Test 3.1: Setup Stripe CLI

Terminal 1: Start Stripe webhook listener

stripe listen --forward-to localhost:3000/api/billing/webhook

Output:

> Ready! Your webhook signing secret is whsec_xxxxxxxxxxxxx

Copy the signing secret to .env.local:

STRIPE_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxx


Test 3.2: Trigger Test Webhooks

Test Events:

  1. Customer Created:

    stripe trigger customer.created
    

  2. Subscription Created:

    stripe trigger customer.subscription.created
    

  3. Invoice Paid:

    stripe trigger invoice.paid
    

  4. Payment Failed:

    stripe trigger invoice.payment_failed
    

Expected Results: - Stripe CLI shows webhook sent - CodeSlick API logs show webhook received - Database updated accordingly

Check Logs (Terminal running npm run dev):

✅ [Webhook] Received: customer.subscription.created
✅ [Webhook] Processed subscription update for team: abc123


Test 3.3: Verify Webhook Signature Validation

Test Invalid Signature:

curl -X POST http://localhost:3000/api/billing/webhook \
  -H "Content-Type: application/json" \
  -H "Stripe-Signature: invalid" \
  -d '{"type":"test.event"}'

Expected Result: - Status: 400 Bad Request - Error: "Webhook signature verification failed"


Test Suite 4: Edge Cases

Test 4.1: Payment Failure

Steps: 1. ✅ Initiate checkout 2. ✅ Use declined card: 4000 0000 0000 0002 3. ✅ Submit payment

Expected Results: - Error message: "Your card was declined" - Not redirected back to CodeSlick - Database: No changes made - User can try again with different card


Test 4.2: Expired Card

Steps: 1. ✅ Initiate checkout 2. ✅ Use card: 4000 0000 0000 0069 (expired card) 3. ✅ Submit payment

Expected Results: - Error message: "Your card has expired" - Payment fails before submission


Test 4.3: Insufficient Funds

Steps: 1. ✅ Use card: 4000 0000 0000 9995 (insufficient funds) 2. ✅ Submit payment

Expected Results: - Error message: "Insufficient funds" - No subscription created


Test 4.4: Member Limit Enforcement

Scenario: Team at member limit tries to add one more

Steps: 1. ✅ Create team with Team plan (limit: 5 members) 2. ✅ Add 5 members 3. ✅ Try to invite 6th member

Expected Results: - API returns 403: "Member limit reached" - Error message: "Your team plan allows up to 5 members. Upgrade to add more." - "Upgrade to Enterprise" CTA shown

API Test:

curl -X POST http://localhost:3000/api/teams/YOUR_TEAM_ID/members \
  -H "Content-Type: application/json" \
  -d '{"email":"sixth@example.com","role":"member"}'

Expected response:

{
  "error": "Member limit reached",
  "message": "Your team plan allows up to 5 members",
  "currentCount": 5,
  "limit": 5,
  "plan": "team"
}


Test 4.5: Downgrade (Cancel Subscription)

Note: Real downgrades are not implemented yet. Cancellation keeps access until period end.

Steps: 1. ✅ Team on Team plan cancels subscription 2. ✅ Subscription ends (simulate by updating database) 3. ✅ Try to add 6th member (should fail)

Expected Results: - Team reverts to Free plan after period ends - Member limit drops to 1 - Existing members remain but cannot add more beyond limit


Test Suite 5: End-to-End Integration

Test 5.1: Full New User Flow

Steps: 1. ✅ New user signs in with GitHub 2. ✅ Installs GitHub App 3. ✅ Team auto-created (Free plan) 4. ✅ Upgrades to Team plan 5. ✅ Invites 4 team members 6. ✅ Members accept invitations 7. ✅ Team has 5 members (at limit) 8. ✅ Owner manages billing via Customer Portal

Expected Results: - All steps complete without errors - Database consistent throughout - UI reflects correct states - Emails logged (until email service implemented)

Verification: - Check audit logs for all actions - Verify subscription active - Verify member count correct


Test Suite 6: Security Testing

Test 6.1: Unauthorized Access

Test: Non-member tries to access billing

# Without auth
curl http://localhost:3000/api/billing/checkout?teamId=SOMEONE_ELSES_TEAM

Expected: 401 Unauthorized


Test 6.2: Non-Owner Access

Test: Team member (not owner) tries to access billing

Expected: - Billing tab not visible in UI - API returns 403 Forbidden if accessed directly


Test 6.3: Webhook Replay Attack

Test: Re-send old webhook

Expected: - Stripe signature validation fails OR - Idempotency key prevents double processing


Test Suite 7: Performance Testing

Test 7.1: Checkout Speed

Measure: - Time from clicking "Upgrade" to Stripe Checkout load

Expected: < 2 seconds


Test 7.2: Webhook Processing Speed

Measure: - Time from webhook received to database updated

Expected: < 1 second


Test 7.3: Portal Access Speed

Measure: - Time from clicking "Manage Billing" to portal load

Expected: < 3 seconds


Post-Testing Checklist

After completing all tests:

Database Verification

-- Check subscriptions table
SELECT COUNT(*) FROM subscriptions WHERE status = 'active';
-- Should match number of paid teams

-- Check invoices table
SELECT COUNT(*) FROM invoices WHERE status = 'paid';
-- Should match or exceed subscription count

-- Check teams table
SELECT plan, COUNT(*) FROM teams GROUP BY plan;
-- Verify plan distribution

Stripe Dashboard Verification

  1. ✅ Navigate to Stripe Dashboard → Customers
  2. ✅ Verify test customers created
  3. ✅ Check subscriptions show "Active"
  4. ✅ Check payment methods saved
  5. ✅ Check invoices generated

Logs Review

# Check application logs for errors
grep ERROR logs/*

# Check webhook processing
grep "Webhook" logs/*

Known Issues & Limitations

  1. Email Notifications: Invitations logged to console, not sent via email (implement in Week 3)
  2. Tax Calculation: Stripe Tax not configured (add before EU launch)
  3. Dunning: No automatic retry for failed payments (implement in beta)
  4. Proration: No mid-cycle plan changes (implement for Enterprise)
  5. Coupons: No discount codes implemented yet (add for beta testers)

Beta Testing Preparation

After all tests pass:

  1. ✅ Switch to Stripe Live mode
  2. ✅ Update environment variables with live keys
  3. ✅ Test with real card (small amount)
  4. ✅ Verify real payment processes
  5. ✅ Refund test payment
  6. ✅ Document any issues
  7. ✅ Ready for beta invitations

Test Results Log

Test Date: _______________

Tester: _______________

Test Suite Status Notes
Suite 1: Free → Team Upgrade
Suite 2: Customer Portal
Suite 3: Webhook Handling
Suite 4: Edge Cases
Suite 5: End-to-End
Suite 6: Security
Suite 7: Performance

Overall Status: ⏳ Not Started | 🔄 In Progress | ✅ Complete | ❌ Failed

Critical Issues Found: _____________

Ready for Beta Launch: YES / NO


Document Version: 1.0 Last Updated: November 5, 2025 Next Review: After beta testing Phase 1