WebsiteTek blog

How an Online Store Really Works: Carts, Checkout and Payments

What happens between Add to cart and Thank you for your order: carts, stock, taxes, payment gateways, PCI rules, 3D Secure and why stores are harder to run.

By Michael Bix, founder and lead designer6 min read

From the customer’s side, buying online takes a minute: pick a product, press “Add to cart”, type a card number, done. Behind that minute, a surprising number of systems have to work together, in the right order, every single time.

If you sell online or plan to, knowing what happens behind the scenes helps you choose the right platform, understand where the costs come from, and know where to look when something goes wrong at checkout. Here is the whole journey, in plain words.

Step 1: the product page

A product page is more than a photo and a price. Behind it sits a record in the store’s database with the product name, description, price, photos, weight for shipping, tax category, and the stock count. If the product comes in sizes or colors, each combination, called a variant, usually has its own stock count and its own code, called a SKU.

This is why setting up a store takes longer than setting up a normal website. Every product needs complete, correct details, because the cart, the shipping calculation, the tax and the stock all depend on them.

Step 2: “Add to cart”

When the customer presses “Add to cart”, the store has to remember that choice while they keep browsing. It does this with a session: the browser keeps a small cookie with an ID, and the store keeps the cart that belongs to that ID on its side.

This is one of the reasons stores are harder to make fast. A normal page can be built once and handed to every visitor from a cache. A cart is different for every visitor, so the cart, the checkout and the account pages have to be built fresh each time. A well-built store caches everything that can be cached and keeps those personal pages light.

Step 3: the checkout

At checkout the store gathers what it needs and runs the numbers:

  • Shipping. Rates depend on the weight, the size, the destination and the carrier, or on simple flat rates you set.
  • Sales tax. Tax rules differ from state to state and sometimes from city to city, and some products are taxed differently from others. Store platforms have tax tools for this, but they have to be set up correctly for your business, and your accountant should confirm the settings.
  • Discounts and gift cards. Each one is another rule the checkout has to apply in the right order.
  • Stock. Just before the order is placed, the store checks that the products are still available, so it does not sell the last item twice.

Step 4: the payment

This is the part most people never see. When the customer presses “Pay”, the card details go to a payment gateway, a company such as Stripe, Square, PayPal or Shopify Payments that connects online stores to the card networks.

The gateway passes the request through the card network, such as Visa or Mastercard, to the bank that issued the customer’s card. That bank checks the account and the risk and answers yes or no. All of this usually takes a few seconds. The money itself arrives in your bank account later, usually within a few business days, minus the card fee.

Why your store should never store card numbers

Card payments are governed by a set of security rules called PCI DSS, the Payment Card Industry Data Security Standard. Storing card numbers on your own server brings heavy responsibilities and a lot of risk.

The modern answer is simple: the store never touches the card number at all. The payment fields on the checkout page are supplied by the payment gateway, the card details go straight to the gateway, and the store only receives a token, a stand-in code that confirms the payment without revealing the card. This is how well-built stores keep both the risk and the paperwork small.

3D Secure: the bank’s extra check

Sometimes the customer’s bank asks for an extra step before approving a payment, such as a code sent by text or a tap in the banking app. This is called 3D Secure. It protects against stolen cards, and in many cases it moves the cost of fraud away from the store and onto the card issuer.

It can also be a source of failed payments. If the extra step does not open properly on a phone, is blocked by a pop-up setting, or the customer does not complete it in time, the payment is declined. When customers report payment errors at checkout, 3D Secure is one of the first things worth checking, together with the gateway’s own payment logs.

Fraud checks

Gateways also run their own checks: does the security code match, does the billing address match the bank’s records, does this order look like known fraud patterns? Orders that look risky can be blocked or held for review. Setting these rules is a balance between stopping fraud and turning away good customers.

Step 5: after the order

Once the payment is approved, the store writes the order into its database, lowers the stock, and sends emails: an order confirmation to the customer and a new-order alert to you. Later come shipping updates, and sometimes refunds or returns, each of which has to adjust the payment, the stock and the records.

Many stores also send an abandoned cart email to customers who started checkout but did not finish, which can win back sales that would otherwise be lost.

Why online stores are harder to run than normal websites

An online store is a small piece of business software, not just a website. That brings extra work:

  • Updates matter more. WooCommerce runs on WordPress and PHP, with a MySQL or MariaDB database, and each part, plus every plugin, needs regular security updates. A store is a more attractive target than a brochure website.
  • More moving parts. Payments, shipping, tax, email and stock all connect to outside services, and any one of them can change its rules.
  • Speed under load. A sale or a holiday rush brings many visitors at once, and the checkout must stay quick when it counts most.
  • Testing. Every change to the checkout should be tested with a real order before customers find a problem.

Shopify, WooCommerce or custom?

We build all three, and the right choice depends on your products and how you like to work:

  • Shopify is a hosted service with a monthly fee. It looks after the technical side, including security, payments and updates, and is easy to run yourself. For most product businesses, it is where we start.
  • WooCommerce is a free shop plugin for WordPress. There is no monthly platform fee, but you pay for hosting, card fees and any special add-ons, and the store needs regular updates, which we can look after for you. It suits businesses that want their store and website in one place with full control.
  • Custom makes sense when a store needs something the platforms do not handle well, such as custom quoting, product configurators or unusual workflows.

You can read more on our e-commerce and Shopify page.

Questions to ask before you open or rebuild a store

  1. How many products and variants do I have, and who will enter their details?
  2. Which payment gateway will I use, and what are its fees?
  3. Is sales tax set up for every state I sell to, and has my accountant checked it?
  4. Does the checkout work smoothly on a phone, including the bank’s 3D Secure step?
  5. Who keeps the platform, plugins and server up to date, and how often?
  6. How are orders and customer data backed up?

The takeaway

Behind “Add to cart” and “Pay now” sit a product database, a session, shipping and tax rules, a payment gateway, the card networks, the customer’s bank, security rules such as PCI DSS and 3D Secure, and a stream of emails and stock updates. When all of them are set up well, the customer never notices any of it. That is the goal.

If you would like a store built that way, see our e-commerce and Shopify page, keep it protected with our website security services, or ask us a question. We answer in plain English, with a fixed price agreed before we start.

More from the blog

Let's talk

Ready for a website that wins customers?

Tell us about your business and we will come back with a clear recommendation and a fixed quote. No pressure, no jargon.

Trades we design for

See all 436 trades

436 trades

  • Plumbers website design concept
CallFree quote