Guide

Payment security for a small online store

Most small stores don’t get robbed through the checkout page. The trouble is in the plumbing around it, the connections between your store, your payment provider and your other tools. This guide explains the common gaps in plain words, and gives you a checklist for the person who built your site.

Where the risk really is

When you take a payment online, your store talks to a payment provider through an API, which is just a set of doors the two systems use to send each other requests. After the payment, the provider calls your store back to say “this order was paid”. That callback is called a webhook.

Every one of those doors needs a lock, and most store owners never see them, because the person who built the site set them up once and moved on. So the questions in this guide aren’t for you to fix, they’re for you to ask.

OWASP, the nonprofit that keeps the standard lists of web security problems, publishes a Top 10 just for APIs. Four of its ten items map directly to a store, and I’ll use them as the backbone: Broken Object Level Authorization (API1), Broken Authentication (API2), Unrestricted Access to Sensitive Business Flows (API6) and Improper Inventory Management (API9).

1. Can one customer see another customer’s order?

This is the top item on OWASP’s API list, Broken Object Level Authorization. In store terms: your site shows an order at an address like /orders/1042. If a logged-in customer can change that to /orders/1043 and see someone else’s name, address and items, the lock is missing. It’s common because the page works perfectly for honest customers, so nobody notices.

  • Ask: “For every order, invoice and customer record, does the server check that it belongs to the person asking?”
  • Ask for a test: log in as customer A and try to open customer B’s order. It must fail.

2. Does your store check who is calling its webhook?

If your store marks an order “paid” when a message arrives at an address, then anyone who finds the address can send a fake “paid” message. Payment providers solve this by signing each message, so your store can prove it came from them. Stripe’s documentation puts the risk directly: without verification, an attacker could send fake webhook events to trigger actions like fulfilling orders or granting access.

What Stripe’s documentation asks you to do is a good model, even if you use a different provider. Check your own provider’s documentation for the equivalent:

  • Verify the signature on every message (for Stripe, the Stripe-Signature header), using the secret for that endpoint.
  • Verify against the raw, unmodified body of the request. Stripe says any manipulation of the raw body makes verification fail.
  • Reject old messages. Stripe’s libraries default to a 5-minute tolerance, so a copied message can’t be replayed later. A tolerance of zero turns the check off.
  • Handle the same event twice. Providers can send duplicates, so log the event IDs you already processed and don’t process them again.
  • Don’t rely on order. Stripe doesn’t guarantee events arrive in the order they happened.
  • Answer quickly with a success code, and do the slow work after.
  • Rotate the signing secret now and then, or right away if you think it leaked.

If you use a hosted checkout page from your provider, where the customer pays on the provider’s page, ask your developer what actually triggers “order paid” in your store. That’s the webhook, and it’s the part to verify.

3. Where are your keys and passwords kept?

Your payment provider gives your store secret keys. If they are written in the website’s code, sitting in a shared document, or sent over chat, they’re one mistake away from being public. OWASP lists Broken Authentication (API2) for this family of problems, weak or exposed ways of proving who is calling.

  • Keys live in the hosting platform’s secret settings, not inside the code that gets published.
  • Test keys and live keys are different, and the live ones are used only by the live store.
  • Whoever leaves the project, you change the keys, same day.
  • Everyone who can reach the payment dashboard uses two-factor authentication.

4. Can someone abuse the normal flow?

OWASP’s API6 is Unrestricted Access to Sensitive Business Flows. Nothing is hacked, the store just allows more than it should. A discount code that can be used a hundred times, a gift card balance that can be checked a thousand times a minute, a refund that can be requested twice, a stock reservation that holds items forever.

  • Ask: “What stops someone from using this code, or this refund, more than once?”
  • Ask that the price and total are calculated on the server, never taken from what the browser sends.
  • Ask that repeated failed attempts (guessing codes, cards or logins) slow down or lock.

5. Does anyone know every door that exists?

API9 on OWASP’s list is Improper Inventory Management. Old test pages, an earlier version of the checkout, a connection to a tool you stopped using. Forgotten doors don’t get updated, and they still work. If nobody can list your integrations, nobody can say they’re all locked.

  • Make a one-page list: every service connected to your store, who owns it, what it can do.
  • Remove what’s unused, including old keys and old webhook addresses.

The checklist to send your developer

Email to your developer or agency
Hi, I’m doing a security review of our store’s payments. Can you confirm, in writing, each of these?

1. Customers can only open their own orders, invoices and addresses. Tested with two accounts.
2. Our payment webhook verifies the provider’s signature on the raw request body, rejects old messages, and ignores duplicate events.
3. Our secret keys are not in the code or in shared documents, test and live keys are separate, and keys were changed after anyone left the project.
4. Prices and totals are calculated on the server. Discount codes, refunds and gift cards have limits, and repeated failed attempts are slowed down.
5. There is a current list of every service connected to the store, and unused ones are removed.
6. Everyone with payment dashboard access uses two-factor authentication.

If something isn’t done yet, tell me what it would take. Thanks.

You’re not expected to judge the technical answers. What you can judge is whether you get clear, specific replies. “Yes, tested on [date]” is a good answer. “Should be fine” isn’t.

Questions

Do these apply to Pix and local payment methods?

The ideas do, since any provider that calls your store back has the same webhook question. The exact header and rules differ by provider, so ask yours for its documentation on verifying notifications.

Isn’t my payment provider responsible for security?

For its own side, yes. The connection to your store, and how your store reacts to messages, is your side, and usually it’s whoever built the site who controls it.

Should I run a scanner?

A scanner can help, but it doesn’t replace the questions above. Wrong-person-sees-the-order and repeated-refund problems are about how the store behaves, and they’re easy for tools to miss.

Sources

Questions about your own setup?

Send me an email, I read everything and answer when I can.

Email me

← All guides