Here’s the absolute simplest path to get Stripe payments up and running—with almost no code at all—plus a slightly more flexible option if you want full “hosted checkout.”
1) Quick & Dirty: Stripe Payment Links
No dev work, no server required. You just generate a link in your Dashboard and embed it wherever you like.
- Log in to your Stripe Dashboard.
- Go to Payments → Payment Links → + Create Payment Link.
- Select or create a Product & Price (one-time or recurring).
- Click Create Link, then copy the URL.
- Drop that URL into a button or hyperlink on your site.
Result: Clicking your button takes customers to a Stripe-hosted checkout page, handles payment, and redirects back with a receipt.
Pros:
- Zero code
- PCI-compliant out of the box
- Customizable branding (in Dashboard settings)
Cons:
- Limited post-purchase hooks (webhooks needed for custom workflows)
2) “Hosted Checkout” via Checkout Session
If you want to control success/cancel redirects, pass metadata, or kick off webhooks, use Stripe Checkout Sessions. This still uses Stripe’s hosted UI—so you never touch raw card data.
a) Front-End (HTML + Stripe.js)
<!DOCTYPE html>
<html>
<head>
<script src="https://js.stripe.com/v3/"></script>
</head>
<body>
<button id="checkout">Buy Now</button>
<script>
const stripe = Stripe("pk_test_…YOUR_PUBLISHABLE_KEY…");
document.getElementById("checkout").addEventListener("click", () => {
fetch("/create-checkout-session", { method: "POST" })
.then(res => res.json())
.then(({ sessionId }) => stripe.redirectToCheckout({ sessionId }));
});
</script>
</body>
</html>
b) Back-End (Node.js example)
npm install stripe express
server.js
const express = require("express");
const app = express();
const stripe = require("stripe")("sk_test_…YOUR_SECRET_KEY…");
app.use(express.json());
app.post("/create-checkout-session", async (req, res) => {
const session = await stripe.checkout.sessions.create({
payment_method_types: ["card"],
line_items: [{
price_data: {
currency: "usd",
product_data: { name: "My Awesome T-shirt" },
unit_amount: 2000, // $20.00
},
quantity: 1,
}],
mode: "payment",
success_url: "https://your-domain.com/success?session_id={CHECKOUT_SESSION_ID}",
cancel_url: "https://your-domain.com/canceled",
});
res.json({ sessionId: session.id });
});
app.listen(4242, () => console.log("Running on port 4242"));
c) Run & Test
- Start server:
node server.js
- Open your HTML file, click the button → the Stripe checkout page appears.
Which to choose?
• Payment Links: fastest way, zero code
• Checkout Sessions: minimal code, more customization (metadata, webhooks, dynamic line items)
Both approaches keep you out of PCI scope since Stripe hosts the actual card-entry form. Pick the one that matches your needs, and you’ll be live in minutes! 🚀