Stripe Payments Integration Setup
Standard Operating Procedure ID: SOP-TECH-002
Version: 3.0.0
Effective Date: Summer Term 2026
Owner: Marcus Ruiz, Lead Operations Architect
1. Overview
This project now uses real Stripe Checkout session creation for website registration payments and public donations.
Implemented pieces:
- Public registration flow hands off to hosted Stripe Checkout
- Public donation flow hands off to hosted Stripe Checkout
- Promo code support for
APEXEXPLORE - Full scholarship bypass support for
APEXSCHOLAR - Stripe return pages at
/register/success,/register/cancel,/donate/success, and/donate/cancel - Cloudflare Pages Functions endpoints:
POST /api/stripe/create-registration-checkoutPOST /api/stripe/create-donation-checkoutGET /api/stripe/session?session_id=...POST /api/stripe/webhook
2. Environment Variables
Cloudflare Pages / production
Add these environment variables in the hosting dashboard:
STRIPE_SECRET_KEY=sk_test_yourkeyhere
STRIPE_WEBHOOK_SECRET=whsec_yourwebhooksecrethere
STRIPE_WEBHOOK_SECRET_SNAPSHOT=whsec_your_snapshot_secret_here
STRIPE_WEBHOOK_SECRET_THIN=whsec_your_thin_secret_here
PUBLIC_PARENT_CONSULT_URL=https://calendly.com/your-team/parent-consult
Local development with Wrangler
Create a local .dev.vars file from .dev.vars.example:
cp .dev.vars.example .dev.vars
Then set:
STRIPE_SECRET_KEY=sk_test_yourkeyhere
STRIPE_WEBHOOK_SECRET=whsec_yourwebhooksecrethere
STRIPE_WEBHOOK_SECRET_SNAPSHOT=whsec_your_snapshot_secret_here
STRIPE_WEBHOOK_SECRET_THIN=whsec_your_thin_secret_here
3. Stripe Dashboard Setup
- Log into the organization’s Stripe Dashboard
- Turn on Test Mode
- Go to Developers → API keys
- Copy the Secret key (
sk_test_...) - Go to Developers → Webhooks
- Create a webhook endpoint for
/api/stripe/webhook - Copy the webhook signing secret (
whsec_...) - If Stripe gives you separate snapshot and thin signing secrets, keep both
- Add the secret(s) to Cloudflare Pages or local
.dev.vars
Recommended subscribed event:
checkout.session.completed
4. Current Registration Discount Behavior
The website currently supports these codes directly in application logic:
APEXEXPLORE→ $20 off tuitionAPEXSCHOLAR→ 100% tuition scholarship, no card charged
In addition, hosted Stripe Checkout is configured with:
allow_promotion_codes = true
That means Stripe dashboard-managed promotion codes can also be entered during checkout.
5. Local Test Flow
Build the site:
npm run build
Preview it with Cloudflare Pages Functions enabled:
npx wrangler pages dev dist --compatibility-date=2026-06-05
Then:
- Open
/register - Complete the student registration wizard
- Choose a program
- Optionally apply:
APEXEXPLOREAPEXSCHOLAR
- Continue to Stripe Checkout
- Complete sandbox payment with a Stripe test card if paying normally
- Confirm the return flow at
/register/success - Open
/donateto test one-time public donations
6. Scheduling Handoff
After a successful registration return, the confirmation page can send families directly into a parent consultation link.
Set the public scheduling URL in site environment config:
PUBLIC_PARENT_CONSULT_URL=https://calendly.com/your-team/parent-consult
If this value is not set, the site falls back to /contact.
7. Webhook Verification
A webhook endpoint now exists at:
POST /api/stripe/webhook
This endpoint verifies the Stripe signature using any configured webhook secret from:
STRIPE_WEBHOOK_SECRETSTRIPE_WEBHOOK_SECRET_SNAPSHOTSTRIPE_WEBHOOK_SECRET_THIN
8. Operational Notes
- Scholarship registrations do not require card entry
- Payment confirmation pages write completed registrations and donations back into the local website ops dashboard in the same browser session
- Secret keys are not exposed client-side
- Registration success pages can hand families off to a Calendly URL through
PUBLIC_PARENT_CONSULT_URL - If
STRIPE_SECRET_KEYis missing, paid checkout requests will return a configuration error
9. Next Recommended Enhancements
Recommended follow-up implementation items:
- Persist confirmed payments to a real backend or CRM instead of browser-local demo storage
- Send email confirmations and internal notifications from webhook events
- Sync completed registrations and donations into HubSpot or Mailchimp
- Add recurring donation mode if the organization wants monthly giving