Tools & Infrastructure

Online Payments and Stripe Explained

What happens when you click "Buy Now" and how Stripe handles the complicated parts so you don't have to.

Scroll to start

What Is an Online Payment?

When you buy something online, a lot more happens behind the scenes than just typing in a credit card number. An online payment is money moving from your bank account to a seller's bank account — through the internet, with a company making sure it all goes smoothly.

The company in the middle is called a payment processor. Its job is to take the card information you type in, send it safely to the card network (like Visa or Mastercard), ask the buyer's bank if the money is available, and then move the money to the seller's account. All of this happens in a few seconds.

Stripe is one of the most popular payment processors. It gives website owners simple tools to accept payments without having to build all that complicated machinery themselves. Instead of building a system to talk to banks and card networks, a developer can use Stripe's ready-made tools and have payments working in an afternoon.

Why This Matters for Anyone Building Online

If you want to sell something on the internet — a course, a subscription, a product — you need a way to take money. You can't just put a "send money to this bank account" link on your page. People need to pay with their credit card, and that means you need a payment processor.

Stripe is popular because it's reliable and developer-friendly. But there are other options too, like PayPal and Square. What makes Stripe stand out is how easy it makes it to also handle subscriptions, issue refunds, track payouts, and deal with failed payments — all from one dashboard.

💡 Key Insight

Stripe doesn't just move money — it handles the messy reality of commerce. Failed charges, disputed payments (called "chargebacks"), and international currencies are all part of running a real business online, and Stripe wraps them up in clean tools.

The Payment Journey, Step by Step

Here's what actually happens from the moment a buyer clicks "Pay" to when the seller sees the money in their account:

How an Online Payment Moves
💳
Buyer Enters Card
Card number, expiry, and CVV go into a secure form
🔒
Stripe Secures It
Card data is encrypted and sent to Stripe's servers
🌐
Card Network
Visa/Mastercard routes the request to the issuing bank
🏦
Bank Approves
The buyer's bank checks funds and says yes or no
Money Moves
Funds transfer to the seller's Stripe account

All of this usually takes 2–5 seconds. The buyer sees a spinner for a moment, then a success screen. Meanwhile, Stripe holds the money briefly and then deposits it into the seller's bank account — typically within 2 business days.

A Simple Stripe Payment Example

Here's what a developer does to add Stripe to a website. Most of the work is handled by Stripe's pre-built checkout page. The developer just creates a checkout button and tells Stripe what product is being sold and for how much:

server.js (Node.js)
// Load the Stripe library with your secret key
const stripe = require('stripe')('sk_test_your_secret_key');

// Create a checkout session when buyer clicks "Pay"
const session = await stripe.checkout.sessions.create({
  payment_method_types: ['card'],
  line_items: [{
    price_data: {
      currency: 'usd',
      product_data: { name: 'My Digital Product' },
      unit_amount: 1999, // $19.99 in cents
    },
    quantity: 1,
  }],
  mode: 'payment',
  success_url: 'https://mysite.com/thankyou',
  cancel_url: 'https://mysite.com/checkout',
});

// Send the session ID to the browser to load Stripe Checkout
res.json({ id: session.id });

The buyer is then taken to a Stripe-hosted page that handles the card entry, security, and confirmation. The developer never sees the card number — Stripe handles that part, which is actually a legal requirement (it's called PCI compliance).

Knowledge Check

Test what you learned with this quick quiz.

Quick Quiz — 3 Questions

Question 1
What is Stripe's role in an online payment?
Question 2
Why does a developer never see the buyer's full credit card number when using Stripe?
Question 3
If a product costs $25, what number would you put in the unit_amount field for Stripe (which uses cents)?