0
Skip to Content
Rental Application
Services
About
Contact
Rental Application
Services
About
Contact
Services
About
Contact
######################################## # index.html ######################################## Rental Application & Fee

Rental Application

Complete the application below and pay the non-refundable application fee to submit.

By submitting you consent to a background/credit check if required. Do not enter Social Security numbers here. If you need an identity document, request it after you connect with the applicant personally.
######################################## # server.js (Node + Express + Stripe) ######################################## /* Install dependencies: npm init -y npm install express stripe dotenv body-parser Run: node server.js This server creates a Stripe Checkout Session and returns the URL. It also stores the applicant info in-memory (you should save to your database). Do NOT use this in production without HTTPS and proper data storage. */ // server.js const express = require('express'); const bodyParser = require('body-parser'); const Stripe = require('stripe'); require('dotenv').config(); const app = express(); app.use(bodyParser.json()); app.use(express.static('public')); // serve index.html from ./public const stripe = Stripe(process.env.STRIPE_SECRET_KEY); // In-memory storage for demo. Replace with a real DB (Postgres, Mongo, etc.) in production. const applications = []; app.post('/create-checkout-session', async (req, res) => { try { const { fullName, email, phone, fee, message, currentAddress, moveIn } = req.body; // Basic validation if (!fullName || !email || !fee) return res.status(400).json({ error: 'Missing required fields.' }); // Save the application (with a status). Do NOT store SSN here. const application = { id: applications.length + 1, fullName, email, phone, fee, message, currentAddress, moveIn, status: 'pending_payment', createdAt: new Date() }; applications.push(application); // Create a Checkout Session. You can either use a price ID or dynamically set the amount (in cents). const session = await stripe.checkout.sessions.create({ payment_method_types: ['card'], line_items: [ { price_data: { currency: 'usd', product_data: { name: `Application fee for ${fullName}` }, unit_amount: Math.round(Number(fee) * 100), }, quantity: 1, }, ], mode: 'payment', // Pass the application id in metadata so you can reconcile on webhook metadata: { application_id: application.id.toString() }, success_url: `${process.env.YOUR_DOMAIN}/success.html?session_id={CHECKOUT_SESSION_ID}`, cancel_url: `${process.env.YOUR_DOMAIN}/cancel.html`, }); res.json({ url: session.url }); } catch (err) { console.error(err); res.status(500).json({ error: 'Server error creating checkout session.' }); } }); // Webhook endpoint note: in production you must listen for checkout.session.completed to // mark the application as 'paid' only after a verified webhook from Stripe. // For demo purposes you can poll or use the query param on success page. app.get('/applications', (req, res) => { res.json(applications); }); const PORT = process.env.PORT || 4242; app.listen(PORT, () => console.log(`Server running on port ${PORT}`)); ######################################## # .env (example) ######################################## # STRIPE_SECRET_KEY=sk_test_xxx # YOUR_DOMAIN=http://localhost:4242 ######################################## # Notes & next steps ######################################## 1) Replace keys and domain in .env. 2) Move index.html into a folder named `public` next to server.js. 3) In production, enable HTTPS, use Stripe webhooks to verify payments, and store applicant data in a secure DB. 4) DO NOT collect SSNs, bank account numbers, or other extremely sensitive personal data in the form. If you need a screening report, integrate a tenant-screening provider and pass only what they require. 5) Consider adding simple CAPTCHA to prevent bots, and include clear refund/non-refundable policy language. If you want, I can also: - provide the success.html and cancel.html pages, - add webhook handler sample code to mark applications as "paid", - show how to integrate a screening provider (SmartMove or RentSpree), - or build a deployment script for Heroku/Vercel. */