Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 38 ยท Getting Started

What Stripe Is and How Online Payments Flow

Understand what Stripe does, who is involved in an online card payment, which Stripe objects model it, and how this course runs its examples without a network.

Taking a card payment on your own website sounds simple: the customer types a number, you receive money. In reality a payment crosses several companies, each with its own rules, and almost every part is regulated. Stripe is a payments platform that hides most of that machinery behind one HTTP API and a set of hosted user-interface pieces. You describe what the customer should pay; Stripe talks to the card networks and banks.

This course teaches Stripe from the first API call to subscriptions, webhooks, marketplaces and compliance. It is about the concepts that stay true across versions, because the API names change slowly but the ideas do not.

Honest note about the examples. Stripe cannot run on this site: it needs your secret API key, an npm package and a network connection, and our code runners have none of those. So every lesson shows the real Stripe code in read-only blocks, and next to it a runnable stand-in written in plain Node.js that behaves like the part of Stripe being discussed. Stand-ins are always labelled. They teach the logic (amounts, statuses, retries, signatures); they are not Stripe itself.

Who is involved in a card payment

Even a single $20 purchase involves five parties:

  • The customer (cardholder), who owns a card.
  • The merchant (you), who sells something.
  • The issuer, the bank that gave the customer the card.
  • The card network (Visa, Mastercard, and so on), which routes messages.
  • The acquirer, the bank that holds the merchant's account and settles money to it.

Stripe plays the role of a payment service provider. It gives you the acquiring relationship, the card-network connections, fraud tooling, payouts and a dashboard, all behind one account.

Who is in a card payment?

Customer Holds the card
Merchant You, selling a product
Issuer The customer's bank
Network Visa, Mastercard
1 / 2

The money flow in one picture

sequenceDiagram
  participant C as Customer
  participant M as Your server
  participant S as Stripe
  participant I as Issuer bank
  C->>M: Click "Pay"
  M->>S: Create PaymentIntent (amount, currency)
  S->>I: Ask: may we charge this card?
  I-->>S: Approved
  S-->>M: status = succeeded
  S-->>M: Webhook: payment_intent.succeeded
  S->>M: Payout to your bank (days later)

The customer pays now; your bank account receives the money a few days later, minus Stripe's fee.

Two things surprise beginners. First, approval is not the same as getting paid: the issuer promises the money, and the actual transfer (settlement) happens later in a payout. Second, the browser's result is not proof of payment. Your server learns the final truth from Stripe, ideally through webhooks (see the Webhooks chapter, coming up in this course).

The objects Stripe gives you

Stripe models everything as JSON objects with an id that starts with a short prefix. Learning these prefixes lets you read logs at a glance.

Object ID prefix What it represents
Customer cus_ A person or company you bill
PaymentMethod pm_ A saved way to pay (card, bank debit...)
PaymentIntent pi_ One attempt to collect a specific amount
Charge ch_ The actual card attempt inside a PaymentIntent
Product / Price prod_ / price_ What you sell and how much it costs
Subscription sub_ A recurring billing agreement
Invoice in_ A bill, one per subscription period
Refund re_ Money returned to the customer
Event evt_ A record that something happened

The prefix is a handy habit-builder. Let us read objects the way Stripe prints them.

Node.js Read Stripe-style IDs (stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

A payment as a small data structure

Here is what a successful payment looks like as data. A real PaymentIntent has dozens of fields; these are the ones you use daily.

JavaScript
// Real Stripe shape (read-only, trimmed).
{
  id: "pi_3Ox91Z2eZvKYlo2C0aBcDeFg",
  object: "payment_intent",
  amount: 2000,          // minor units: 2000 = $20.00
  currency: "usd",
  status: "succeeded",
  customer: "cus_Nf8d2K",
  metadata: { order_id: "A-1043" }
}

Notice amount is an integer in the smallest unit of the currency. That one rule prevents a whole class of rounding bugs, and the next chapter spends a full lesson on it.

Node.js A stand-in payment object

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

What you will build in this course

By the end you will know how to take one-time payments with Checkout and PaymentIntents, run subscriptions with trials and proration, react to webhooks safely, split money between sellers on a marketplace, test failure cases, and stay on the right side of PCI and tax rules. Next you will open an account and learn how API keys work: Accounts and API Keys. The whole course is listed on the track page.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which party actually decides whether a card payment is approved?

    The issuer holds the cardholder's account and approves or declines. Stripe relays the request through the card network.
  2. 2. A PaymentIntent has amount 2000 and currency usd. How much is charged?

    Amounts are integers in the smallest currency unit, so 2000 cents is $20.00.
  3. 3. What kind of object does an ID that starts with sub_ identify?

    sub_ is the Subscription prefix. Recognising prefixes makes logs much easier to read.
  4. 4. Why does this course pair real Stripe code with stand-ins?

    Real calls need a secret key and network. Stand-ins teach the logic safely, and are always labelled.

Summary

  • Stripe is a payment service provider: one API in front of acquirers, card networks and issuers.
  • Approval and payout are separate events; payouts arrive days later.
  • Stripe objects have prefixed IDs (cus_, pi_, sub_, evt_).
  • Amounts are integers in minor units.
  • Real Stripe code is read-only here; runnable stand-ins are labelled.

Next: Accounts and API Keys