Public
LikePaymentsys
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
To enable payment processing with Visa/Mastercard, you'll need to set up Stripe:
- Go to stripe.com and create an account
- Complete the account verification process
- Navigate to the Dashboard
- In the Stripe Dashboard, go to Developers → API keys
- Copy your Publishable key (starts with
pk_) - Copy your Secret key (starts with
sk_)
- Go to your Val Town settings
- Add these environment variables:
STRIPE_PUBLISHABLE_KEY: Your Stripe publishable keySTRIPE_SECRET_KEY: Your Stripe secret key
- In Stripe Dashboard, go to Developers → Webhooks
- Add endpoint:
https://your-val-town-url.web.val.run/api/payments/webhook - Select events:
payment_intent.succeeded - This ensures trainers are marked as sold when payments complete
- In your Stripe Dashboard, go to Settings → Payouts
- Add your bank account details where you want to receive payments
- Stripe will handle the transfer of funds to your account
Stripe supports many countries. Check Stripe's supported countries to ensure your location is supported.
- Stripe starts in test mode by default
- Use test card numbers like
4242 4242 4242 4242 - No real money is processed in test mode
- Complete Stripe's verification process
- Switch to live mode in your Stripe Dashboard
- Update your environment variables with live keys (they'll start with
pk_live_andsk_live_)
- Never expose your secret key in client-side code
- The current implementation uses a simplified payment flow
- For production, consider implementing additional security measures like webhook signature verification
If you need help with Stripe integration:
- Check Stripe's documentation
- Contact Stripe support
- Review the payment flow in
/backend/routes/payments.ts