Skip to content
Bugwise
Menu
Features & Flows

Shopping Cart and Checkout

How a cart and checkout flow works, where the money bugs hide (quantities, coupons, shipping, rounding, double charges), and how to test it safely with test cards.

45–70 min beginner Mobile & web

You add a pair of running shoes to your cart on your phone during lunch, finish the order on your laptop that evening, and get an email a minute later: “Thanks for your order!” Behind those few taps sit stock checks, price calculations, a payment gatewayPayment gatewayA third-party service that processes card payments for an app or website.Open in glossary →, and an email service, and every one of them can go wrong.

Checkout is where an app makes its money, so bugs here hurt twice: customers get charged the wrong amount (or twice), and the business loses sales when people give up. That makes it one of the most valuable features you’ll ever test.

Part Not started

How it works

Most stores split checkout into a few clear steps. The names change from app to app, but the flow is almost always the same. Click through each step to see what happens there and what to test.

What happens

The shopper reviews items, changes quantities, removes things or saves them for later, and enters a coupon.

Classic bug

Total does not refresh after removing an item.

What to test

  • Quantity limits (min 1, max stock)
  • Remove and save for later update the totals
  • Coupons: valid, expired, used twice, lower/upper case
  • Cart survives closing the app and logging in on another device
Step 1 of 6
  1. Cart. The shopper reviews items, changes quantities, removes items or moves them to “Save for later”, and enters a couponCouponA code that gives a discount or free shipping, usually with rules like expiry and minimum order.Open in glossary →. The cart shows a running subtotal.
  2. Shipping. A delivery address is typed in (a guest, someone buying without an account) or picked from saved addresses (a logged-in user). The country often changes the shipping price and tax.
  3. Delivery. The shopper picks standard, express or store pickup. Each option has its own price and estimated delivery date.
  4. Payment. The shopper pays by card, Apple Pay, Google Pay or PayPal. The store doesn’t talk to the bank itself: a payment gateway (a company such as Stripe, Adyen or Braintree) takes the payment and answers “approved” or “declined”, sometimes after an extra bank check called 3-D Secure3-D SecureAn extra step where the card's bank asks the shopper to confirm an online payment.Open in glossary →.
  5. Review. One last summary: items, address, delivery, payment method and the final total. Some apps merge this into the payment step.
  6. Confirmation. The order number appears, the cart is emptied, stock is reserved, and a confirmation email or push notification goes out.

Cart behaviors to know

The cart looks like a simple list, but it has a lot of rules:

The price math

Every total on a checkout screen is a small calculation. Your job is to know the formula, so you can calculate the expected total yourself.

LineWhat it isWhat to watch for
SubtotalSum of price × quantity for every itemUpdates after every change, including removals
Discounts / couponsPercentage (10% off) or fixed amount ($5 off), sometimes with a minimum orderApplied once, stacking rules, expiry date, upper/lower case codes
ShippingFlat price, by weight or by country; often free over a thresholdIs the threshold checked before or after the discount?
Tax / VATIn the US, sales tax is added at checkout. In the EU and UK, prices usually already include VAT (their sales tax)Correct rate per country or state; tax on the discounted price
RoundingMoney is shown with 2 decimals (none for currencies without cents, like the Japanese yen)No 59.900000001, no totals that are off by one cent

Try it yourself. Work out each total on paper, then check your answer:

Price calculator check

Work out the expected total before you look at the app. That is your expected result.

Cart

  • 2 × T-shirt$14.50 each
  • 1 × Baseball cap$22.00 each

Rules

  • Coupon SAVE10: 10% off the items
  • Shipping $4.99, free when the total after discounts is $50 or more
  • Prices include tax

Check this part

  1. Subtotal $54.00, coupon 10% off, free shipping when the total after discounts is $50 or more. Shipping is $4.99. What is the correct total?

  2. A guest adds a phone case to the cart, then logs in to an account whose saved cart already holds a cable. What should the cart contain?

The checkout steps from cart to confirmation, the rules a cart follows, and the price math behind every total.

Part Not started

Payments, double charges and confirmation

Always use test cards

Here are a few of Stripe’s published test cardsTest cardA card number published by a payment provider to simulate payments in test mode.Open in glossary → as an example (check Stripe’s testing docs for the current list). Any future expiry date and any 3-digit CVC (the security code printed on the card; 4 digits for American Express) work. Other gateways (Adyen, Braintree, PayPal) publish their own lists.

ScenarioTest card (Stripe)Expected result
Approved4242 4242 4242 4242Payment succeeds, order is created
Generic decline4000 0000 0000 0002“Your card was declined.” No order, cart kept
Insufficient funds4000 0000 0000 9995Clear message, user can try another card
3-D Secure required4000 0027 6000 3184Bank challenge appears; pass, fail and cancel it
Expired card4000 0000 0000 0069“Your card has expired.”
Wrong CVC4000 0000 0000 0127“Your card’s security code is incorrect.”

3-D Secure is an extra step where the bank asks the shopper to confirm the payment, usually in their banking app or with a code. The checkout opens a bank page (or a pop-up), waits, and then continues. It’s a hand-off between three systems, which makes it a favorite place for bugs: test passing, failing, canceling, and closing the challenge.

Double charges and idempotency

What happens if a shopper taps Pay twice because nothing seemed to happen? Or the network drops just after the payment went through, and the app retries? Without protection, you get two orders and two charges. This is a double submitDouble submitA bug where an action runs twice because the user tapped or clicked twice quickly.Open in glossary → bug.

Good checkouts defend in two layers:

Order confirmation emails

The confirmation email is part of the feature. Check that exactly one email arrives, quickly, with the right order number, items, quantities, prices, discount, shipping, tax, total, address and delivery estimate. In test environments, emails are usually caught by a test inboxTest inboxA fake mail server for test environments that catches every email the app sends, so none reach real people.Open in glossary → (a tool like Mailtrap or MailHog), so they never reach real customers. Ask where yours is. Email Notifications covers testing emails in depth.

Example requirements

Notice how specific these are. “Free shipping over $50” alone would leave testers and developers guessing about discounts. If a requirement is vague, ask before you test. See acceptance criteriaAcceptance criteriaConditions a user story must meet to be considered done and accepted.Open in glossary → and user storyUser storyA short description of a feature from the user's point of view.Open in glossary → in the glossary.

Check this part

  1. You need to test a declined payment on staging. What should you use?

  2. A user double taps "Pay" and gets charged twice. Which fix protects against this even if the UI fails?

Why you only ever pay with test cards, how double charges are prevented, the confirmation email, and example requirements for the whole flow.

Part Not started

What usually goes wrong

The severity column shows a typical rating (Severity vs priority explains the scale). Bugs that take a customer’s money sit at the top.

#BugWhat you seeTypical severity
1Quantity below 1Item shows quantity 0 or −1 and a negative price, lowering the totalHigh
2Coupon stackingThe same code can be applied twice, or two “not combinable” codes both applyHigh
3Wrong shipping thresholdFree shipping uses the subtotal before discount (or after tax)Medium
4Rounding errors (floating-point)$53.928, 59.900000001, or lines that don’t add up to the totalMedium–High
5Double chargeDouble tap or retry creates two orders and two chargesCritical
6Stale totalsRemoving an item or changing country doesn’t update the summaryHigh
7Out-of-stock item paid forItem sold out during checkout but the order still goes throughHigh
8Price changed silentlyPrice changes between cart and payment and the user isn’t toldHigh
9Cart lost or duplicatedItems disappear after login, or quantities double when carts mergeMedium–High
10Broken 3-D Secure returnAfter approving in the bank app, the user lands on an error or an empty cartCritical
11Wrong confirmation emailNo email, two emails, or the email shows a different totalMedium

Find the bug

This little store app has six bugs in its cart and checkout. The test dataTest dataThe input values, accounts and records you use while testing.Open in glossary → card lists the valid coupon codes and the shipping rule. Explore it like a tester:

  • Calculate the expected total yourself before you trust the screen.
  • Push quantities to their limits in both directions.
  • Apply coupons more than once.
  • Remove an item and look at the summary.
  • Tap Pay quickly, twice, and watch the network log (the list of requests the app sent to the server).

🐞 Bug hunt: Cart & checkout

This demo has 6 hidden bugs. Explore it like a tester, then check your findings.

Found0/6
9:41
ShopCart (4)

Wireless earbuds

$29.99

White · $29.99

1

Phone case

$12.95

Midnight blue · $12.95

1

USB-C cable 2 m

$16.98

Braided · $8.49 · Only 3 left

2
Subtotal$59.92
ShippingFree

Free shipping on orders over $50 · prices include VAT

Total$59.92
Visa •••• 4242TEST

Test data

  • SAVE10 10% off the order (once per order)
  • FREESHIP free shipping
  • SPRING5 expired code
  • Shipping $4.99, free when the order total after discounts is $50 or more.
Network logOrders: 0
  • Change the cart to see API requests…
  1. 1

    Hint: Keep tapping minus on one item.

  2. 2

    Hint: Apply SAVE10, then apply it again.

  3. 3

    Hint: Lower the USB-C cable to 1, then apply SAVE10. Is shipping still free?

  4. 4

    Hint: Apply SAVE10 and read the Total line carefully. Compare it with the Pay button.

  5. 5

    Hint: Tap Pay twice quickly and check the network log.

  6. 6

    Hint: Remove an item and look at the summary (and the Pay button).

Check this part

  1. The total on screen shows $59.900000001. What kind of bug is this?

  2. After approving a payment in the bank app, the user lands on an empty cart. How severe is a broken 3-D Secure return?

The cart and checkout bugs teams ship again and again, and a broken checkout to find them in.

Part Not started

Test scenarios

A test scenarioTest scenarioA high-level idea of what to test, such as 'User resets a forgotten password'.Open in glossary → is a one-line idea of what to check. Group them, so you can see what you’ve covered.

Functional

  • Add, increase, decrease and remove items; the count, subtotal and total update every time.
  • Move an item to “Save for later” and back; prices and totals stay correct.
  • Apply a valid percentage coupon and a valid fixed-amount coupon; the discount is right.
  • Shipping changes with the delivery option and the country, and becomes free at the threshold.
  • Tax or VAT matches the rate for the address.
  • Pay with each method (card, Apple Pay, Google Pay, PayPal) using test accounts.
  • Successful payment shows the order number, empties the cart and sends one confirmation email.
  • A logged-in user’s cart is the same on phone and web; a guest cart merges correctly after login.

Negative

Edge cases

Use boundary value analysisBoundary value analysisTesting values at and just around the edges of valid ranges, where bugs love to hide.Open in glossary → on every number in the flow:

UI & usability

Security

Accessibility

Check this part

  1. Which quantity values are the best boundary tests for a cart with 3 items in stock?

  2. With a proxy tool you change the price in the checkout request to $1. What should happen?

What to check: functional, negative, edge cases, UI, security and accessibility.

Part ProNot started

Example test cases

All of these run on a staging store in payment test mode, with the Stripe test cards from earlier in the lesson (swap in your own gateway’s numbers). The amounts follow the example requirements: SAVE10 gives 10% off, and shipping is $4.99 unless the total after discounts reaches $50. TC-CHK-003 slows the connection down so there is time for a second tap: in Chrome DevTools that’s Network tab › throttling › Slow 4G.

TC-CHK-001Successful card payment creates one order

Preconditions

  • Staging store in payment test mode
  • Cart contains 1 × Wireless earbuds ($29.99)

Steps

  1. Open the cart and tap Checkout
  2. Enter a valid shipping address
  3. Choose Standard delivery
  4. Pay with the approved test card
  5. Confirm on the review screen

Test data

Card: 4242 4242 4242 4242, any future expiry date, CVC 123

Expected result

Confirmation screen shows an order number. The cart is empty. Exactly one order and one charge appear in the admin and gateway dashboard. One confirmation email arrives with the same total.

TC-CHK-002Declined card keeps the cart and shows a clear error

Preconditions

  • Cart contains at least one item

Steps

  1. Go to the payment step
  2. Pay with the generic decline test card

Test data

Card: 4000 0000 0000 0002

Expected result

Message "Your card was declined. Try another card." appears. No order is created. Cart and entered address are kept.

TC-CHK-003Double tap on Pay charges only once

Preconditions

  • Network throttled to "Slow 4G"
  • DevTools Network tab (or a proxy tool) open and recording requests

Steps

  1. Go to the payment step with a valid test card
  2. Tap Pay twice within 1 second

Expected result

The button is disabled after the first tap. One order request (or a duplicate rejected by idempotency key). One order, one charge.

TC-CHK-004Free shipping threshold is checked after the discount

Preconditions

  • Cart subtotal is $51.43

Steps

  1. Apply coupon SAVE10
  2. Look at the shipping line and total

Test data

Coupon: SAVE10

Expected result

Discount −$5.14, shipping $4.99, total $51.28. Shipping is not free because $46.29 is under $50.

TC-CHK-005The same coupon cannot be applied twice

Steps

  1. Apply coupon SAVE10
  2. Enter SAVE10 again and tap Apply
  3. Enter save10 (lower case) and tap Apply

Expected result

Both repeat attempts show "This code is already applied". The discount stays at 10%.

TC-CHK-006Quantity cannot go below 1

Preconditions

  • Cart contains 1 × Phone case

Steps

  1. Tap the minus button next to Phone case

Expected result

Minus is disabled at quantity 1, or the app asks "Remove Phone case from your cart?". Quantity never shows 0 or a negative number.

TC-CHK-007Removing an item updates all totals immediately

Preconditions

  • Cart contains 3 different items

Steps

  1. Tap Remove on one item

Expected result

Item count, subtotal, discount, shipping and total update straight away and match a manual calculation.

TC-CHK-0083-D Secure challenge can be completed and canceled

Steps

  1. Pay with the 3-D Secure test card
  2. Complete the challenge
  3. Repeat with a new cart and cancel the challenge

Test data

Card: 4000 0027 6000 3184

Expected result

Completed: order is created and confirmation shown. Canceled: no order, the user returns to the payment step with the cart intact and a clear message.

TC-CHK-009Guest cart merges after login

Preconditions

  • Account already has 1 × USB-C cable in its saved cart

Steps

  1. Log out
  2. As a guest, add 1 × Phone case
  3. Log in to the account

Expected result

Cart contains both the USB-C cable and the Phone case, each once, and the totals are correct.

TC-CHK-010Item sells out during checkout

Preconditions

  • Item has stock 1
  • A second test account is available

Steps

  1. Account A adds the item and goes to the payment step
  2. Account B buys the same item
  3. Account A taps Pay

Expected result

Account A sees "This item is no longer available", is not charged, and can update the cart.

Tip: click a test case to expand it.

Check this part

  1. In the declined card test case, what should happen after the decline?

  2. In the successful payment test case, how do you check that only one order was created?

Cart and checkout test cases with exact steps and expected results.

The rest of this lesson is in Bugwise Pro

The last parts of every lesson are part of Bugwise Pro. Sign in to unlock them if you have it.

Part ProNot started

Mobile vs web

Check this part

  1. During 3-D Secure on mobile, the user switches to the banking app and comes back. What should happen?

  2. On the web, you refresh the page on the "Processing…" screen. What is the expected result?

Wallets, backgrounding during 3-D Secure and returning from the bank on mobile; refresh, Back, tabs and pop-ups on the web.

The rest of this lesson is in Bugwise Pro

The last parts of every lesson are part of Bugwise Pro. Sign in to unlock them if you have it.

Checklist

Cart & checkout checklist

0 of 13 checked

Key takeaways

  • Checkout runs cart → shipping → delivery → payment → review → confirmation. Test each step and the hand-offs between them.
  • Calculate the expected total yourself: subtotal, discount, shipping threshold, tax and rounding. Lines must add up to the cent.
  • Classic cart bugs: quantity below 1, coupon stacking, wrong shipping threshold, stale totals, lost or doubled carts.
  • Never use real cards. Use the gateway’s test cards for approved, declined, insufficient funds and 3-D Secure.
  • Double taps, refreshes, back buttons and retries must never create a second order. Look for idempotency.
  • On mobile, test Apple Pay / Google Pay and app backgrounding during 3-D Secure; on the web, refresh, back and multiple tabs.

Finished this page?Nice work, this page is complete!

Mark it as done to track your progress. It's saved in this browser, no account needed.

Its cards are now in your Bites review ⚡
Esc

Type to search the whole site.