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.

35 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.

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 coupon. The cart shows a running subtotal.
  2. Shipping. A delivery address is entered (guest) or picked from saved addresses (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 payment gateway (Stripe, Adyen, Braintree and so on) approves or declines the payment, 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 / VATUS sales tax is added at checkout; EU and UK prices usually include VATCorrect rate per country or state; tax on discounted price
RoundingMoney is shown with 2 decimals (0 for currencies like JPY)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

Payments: 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 (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 tool like Mailtrap or MailHog so they never reach real customers.

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.

What usually goes wrong

#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$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 data 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.

🐞 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).

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:

  • Quantity: 0, 1, −1, max stock, max stock + 1, 999, and typed values like 1.5 or abc if the field accepts typing.
  • Coupons: stacking the same code, two codes that shouldn’t combine, an expired code, a code that expires during checkout, save10 vs SAVE10 vs SAVE10 with spaces.
  • Thresholds: order totals of $49.99, $50.00 and $50.01, before and after a discount.
  • Price changes during checkout: the price changes after the item was added to the cart. The user must be told before paying.
  • Out of stock: the item sells out (another user buys the last one) while you’re on the payment step.
  • Session timeout: leave the checkout open for 30+ minutes, then pay. Is the sessionSessionThe period during which a user stays logged in without entering their credentials again.Open in glossary → renewed or are you sent back safely, with the cart kept?
  • Back button during payment: go back from the 3-D Secure page or the processing screen. No duplicate order, no lost cart.
  • Very large orders: 50 different items, or a total with many digits. Does the layout break?

UI & usability

Security

Accessibility

Example test cases

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, expiry 12/30, 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 3G"
  • Proxy or DevTools recording traffic

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.

Mobile vs web

  • Browser refresh during payment. Refresh on the “Processing…” screen and on the confirmation page. Neither may create a second order.
  • Back button. Press Back from the 3-D Secure page, the payment step and the confirmation page. The order must not be repeated, and the cart must not come back after a successful order.
  • Multiple tabs. Open the cart in two tabs, change it in one, pay in the other. The order must match the latest cart.
  • Autofill. Browser and password manager autofill should fill address and card fields correctly (and the right fields).
  • Pop-up blockers. Some 3-D Secure flows use pop-ups or iframes; make sure they still work with strict browser settings and in Safari.
  • Cookies and sessions. Test with cookies blocked, in private mode, and after the session expires. Clear the cacheCacheStored copies of data or files that make apps and websites load faster.Open in glossary → and check the guest cart behavior.
  • Wallets on the web. Apple Pay is built into Safari (some other browsers can offer it through a code you scan with an iPhone), and Google Pay works in Chrome and other browsers. Check the buttons only appear where they’re supported.

Checklist

Cart & checkout checklist

0 of 13 checked

Check your understanding

Quick quiz

0/5 answered · 0 correct

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

  2. 2.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?

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

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

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

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 review cards are now in Bites ⚡
Esc

Type to search the whole site.