Launch a working website with Stripe payments and ChatGPT in 10 minutes
Integrate Stripe payments and an AI assistant into your working website - with no upfront investment
- 1.Create an OpenAI API key. Go to platform.openai.com, open the 「API keys」 section and click 「Create new secret key」. Copy the key to a notepad.
You'll get $5 in free credits valid for 3 months. Store the key in the OPENAI_API_KEY environment variable on your server - never put it in code or the browser.
OpenAI API ↗ - 2.Create a Stripe account. Go to stripe.com, click 「Sign up」, fill in your details. In the dashboard, copy your Publishable key and Secret key to a notepad.
Stripe charges 2.9% + $0.30 for each successful payment. You don't pay until your first payment. Never put the Secret key in frontend code.
Stripe ↗ - 3.Create a repository on GitHub. Click 「New repository」, name it, select Node.js .gitignore. Clone it locally: git clone [your-repo-link]
You'll need a git repo to deploy your app to Vercel with one click.
GitHub ↗ - 4.Create a Node.js application. In your repo folder, create package.json and copy this into it: { «name»: «stripe-chatgpt-site», «version»: «1.0.0», «main»: «server.js», «dependencies»: { «express»: «^4.18.2», «stripe»: «^14.0.0», «openai»: «^4.28.0», «cors»: «^2.8.5», «dotenv»: «^16.3.1» } } Then run: npm install
package.json contains all necessary libraries. npm install will set them up locally.
Node.js ↗ - 5.Create a server.js file in your repo root and copy this into it: javascript const express = require('express'); const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY); const { OpenAI } = require('openai'); const cors = require('cors'); require('dotenv').config(); const app = express(); app.use(express.json()); app.use(cors()); const openai = new OpenAI({ apiKey
This code creates two endpoints: one for Stripe payments, another for ChatGPT conversations. It uses the budget-friendly gpt-4o-mini model to stretch your $5 credit further.
Express.js + OpenAI + Stripe SDK ↗Promptconst response = await openai.chat.completions.create({ model: 'gpt-4o-mini', messages: [{ role: 'user', content: '[YOUR_MESSAGE]' }], max_tokens: 200, }); Replace [YOUR_MESSAGE] with the text you want to send to the model. max_tokens=200 limits the response to 200 tokens (~150 words) and saves money.What this prompt doesThis is code for talking to the ChatGPT API. You substitute your text for [YOUR_MESSAGE], and the model returns a response. The max_tokens=200 parameter limits response length so you don't burn through your $5 credit on day one. - 6.Create a .env file in your repo root and copy this into it: OPENAI_API_KEY=[YOUR_OPENAI_KEY] STRIPE_SECRET_KEY=[YOUR_STRIPE_SECRET_KEY] PORT=3000 Replace [YOUR_OPENAI_KEY] with the API key from step 1 and [YOUR_STRIPE_SECRET_KEY] with the Secret key from step 2.
⚠️ IMPORTANT: Never commit your .env file to git. Create .gitignore with node_modules/ and .env so your secret keys don't end up in the repo.
- 7.Deploy to Vercel. Go to vercel.com, click 「Import Project」, select your GitHub repository. In the Environment Variables field, add: OPENAI_API_KEY = [your key] STRIPE_SECRET_KEY = [your key] Click 「Deploy」. In 2-3 minutes your site will be online at https://[name].vercel.app
Vercel automatically detects Node.js apps and deploys them. Environment variables are entered in the Vercel dashboard, not in code. After deployment, you can test the API with POST requests to https://[name].vercel.app/chat and https://[name].vercel.app/create-payment-intent
Vercel ↗
- freeChatGPT (free account)40 requests per 3 hours; for more frequent use you need a ChatGPT Plus subscription ($20/month).
- freeCodePen or Replit (free plan)Completely free for editing and testing code in the browser.
- freeStripe (test mode)Free to test payments in sandbox mode; switching to live keys costs 2.9% + $0.30 per transaction.
- freeVercel or Netlify (free tier)Free to deploy frontend; backend requires a paid plan ($7+/month) or serverless functions with limits.
Why today
AI services change fast - interfaces and free limits may differ from what's described.