Stripe Integration Guide

Complete checklist for development team

Backend Functions Created ✅ | Frontend Integration Pending ⏳

Setup Phases

Phase 1: Stripe Account Setup
~1-2 hours
Create Stripe account at dashboard.stripe.com/register
Complete business verification
Add bank account for payouts
Complete tax information (W-9/W-8)
Phase 2: Enable Stripe Connect
~30 mins
Dashboard → Settings → Connect
Enable 'Standard accounts' for promoters
Configure platform branding (WHA logo)
Enable automatic transfers
Phase 3: Get API Keys
~15 mins
Dashboard → Developers → API keys
Copy Publishable key (pk_test_...)
Copy Secret key (sk_test_...)
Add STRIPE_SECRET_KEY to Base44 secrets
Phase 4: Configure Webhooks
~30 mins
Dashboard → Developers → Webhooks
Add endpoint: /api/functions/stripeWebhook
Select events: checkout.session.completed, payment_intent.*, charge.refunded, account.updated
Copy webhook signing secret (whsec_...)
Add STRIPE_WEBHOOK_SECRET to Base44 secrets
Phase 5: Frontend Integration
~2-4 hours
Update CartCheckout.jsx - Replace simulation with stripeCheckout call
Update MembershipCheckout.jsx - Replace simulation with stripeCheckout call
Update StripeOnboarding.jsx - Replace simulation with stripeConnectOnboard call
Update Refunds.jsx - Replace simulation with stripeRefund call
Create CheckoutSuccess.jsx page
Create CheckoutCancel.jsx page
Phase 6: Testing
~2-3 hours
Test membership purchase (card: 4242 4242 4242 4242)
Test event registration
Test ticket purchase with multiple quantities
Test camping reservation
Test refund process
Test promoter Stripe Connect onboarding
Test early bird pricing
Test late fee pricing
Test failure scenarios (card 4000 0000 0000 0002)
Verify webhook delivery logs
Phase 7: Go Live
~1 hour
Switch Stripe to Live mode
Get Live API keys (sk_live_...)
Update STRIPE_SECRET_KEY with live key
Update webhook endpoint to live mode
Get new STRIPE_WEBHOOK_SECRET for live
Process $1 test transaction in live mode
Verify webhook fires and entities update
Confirm payout scheduled

Backend Functions (Already Created ✅)

stripeCheckout.js
POST /v1/checkout/sessions

Create checkout sessions for all purchases

stripeWebhook.js
Webhook Consumer

Handle payment events & update entities

stripeConnectOnboard.js
POST /v1/accounts + /v1/account_links

Promoter Stripe Connect onboarding

stripeRefund.js
POST /v1/refunds

Process refund requests

stripeGetBalance.js
GET /v1/balance

Check balances & payouts

Required Secrets

STRIPE_SECRET_KEY
Format: sk_test_... or sk_live_...
Get from: Dashboard → Developers → API keys
STRIPE_WEBHOOK_SECRET
Format: whsec_...
Get from: Dashboard → Developers → Webhooks (after creating endpoint)

Webhook Events to Configure

EventAction Taken
checkout.session.completedCreate Registration/Ticket/Camping records
payment_intent.succeededConfirm payment success
payment_intent.payment_failedMark transaction as failed
charge.refundedUpdate refund status
account.updatedUpdate promoter Connect status
transfer.createdMark payout as initiated
transfer.reversedHandle reversed payout
payout.paidMark payout as completed, notify promoter
payout.failedMark payout as failed, notify promoter urgently
customer.subscription.createdActivate membership, update user
customer.subscription.updatedUpdate membership status/tier
customer.subscription.deletedDowngrade to free tier
invoice.payment_succeededHandle renewal, update dates
invoice.payment_failedMark past_due, notify user urgently

Already Built Features

Membership Tiers
  • Free (default)
  • Basic ($29/yr)
  • Premium ($75/yr)
  • Promoter (configurable)
Purchasable Items
  • Race Registrations
  • Event Tickets
  • Camping Reservations
  • Merchandise/Products
Tiered Pricing
  • Early bird pricing
  • Late fee pricing
  • Regular pricing
  • Auto-calculates based on dates
Premium Early Access
  • Premium: registration_open_date
  • Basic: basic_access_date
  • Free: Countdown timer
Fee Structure
  • Stripe: 2.9% + $0.30
  • WHA Platform: 5% + $1.00
  • Total: 7.9% + $1.30
  • Configurable via WHAFeeConfig

Missing Features (Build Later)

Sales Tax Calculation

Need to add sales_tax_enabled field to Event entity & integrate Stripe Tax or TaxJar API

Recurring Subscriptions

Auto-renewing memberships via Stripe Billing (currently one-time payments)

Stripe Promotion Codes

Native discount codes in Stripe checkout (currently custom implementation)

Stripe Test Cards

4242 4242 4242 4242✅ Successful payment
4000 0000 0000 0002❌ Declined
4000 0000 0000 9995❌ Insufficient funds
4000 0025 0000 3155🔐 Requires 3D Secure

All test cards: Use any future expiry (12/34), any CVC (123), any ZIP (12345)

View all test cards

Fee Structure

Stripe Processing Fee2.9% + $0.30
WHA Platform Fee5% + $1.00
Total per Transaction7.9% + $1.30

Example Calculation:

Ticket Sale:$100.00
Stripe Fee:-$3.20
WHA Fee:-$6.00
Promoter Receives:$90.80

Frontend Files to Update

components/cart/CartCheckout.jsx

Line ~48: Replace simulation with stripeCheckout function call

components/checkout/MembershipCheckout.jsx

Line ~131: Replace simulation with stripeCheckout function call

pages/StripeOnboarding.jsx

Line ~52: Replace simulation with stripeConnectOnboard function call

pages/Refunds.jsx

Lines 128-264: Replace simulated refunds with stripeRefund function call

NEW FILE
pages/CheckoutSuccess.jsx

Create success page for post-checkout redirect

NEW FILE
pages/CheckoutCancel.jsx

Create cancel page for abandoned checkouts

Timeline
Setup & Config:3-4 hours
Frontend Integration:2-4 hours
Testing:2-3 hours
Total:1-2 days
Security Notes
Never expose secret keys in frontend
Always verify webhook signatures
Use HTTPS for all endpoints
Test thoroughly before going live
WHC

World Hillclimb Community - The premier platform for hillclimb motorcycle racing.

Contact

info@worldhillclimb.org
Follow us for live updates

© 2025 World Hill Climb Community. All rights reserved.