Blueprint · Commerce

Gift cards and store credit

A small shop that sells gift cards and gives store credit, where a balance is never a number somebody edits. What is left on a card is what its movements add up to. It cannot go below zero, it stays correct when two tabs spend it at once, and anybody who asks where their money went gets a list.

L3–L5

Level range

8

Sprints

39

Tasks

Backend and frontend

Built as

By the last sprint

What you’ll build

A shop with gift cards and store credit. Customers buy a card for somebody else, who spends it across several orders without ever going below zero. Money from a cancelled or refunded order comes back where it can be spent again, balances warn before they expire, and every movement adds up to the number on screen.

What you’ll learn

A skill in every sprint

You show you have it in a pull request your team reviews, then explain it in a walkthrough.

01

Authentication

You can register and sign in a user, keep a request authenticated without asking for the password again, and explain where the credential lives in the browser and why there rather than somewhere else.

02

A cart that survives

You can add, change and remove items, keep the cart across a logout and login, and show a total that reflects prices as they are now.

03

A ledger you can trust

You can record credits and debits and produce a balance that is the sum of them — and explain why the balance is not a column you update, and what happens when two movements land at once.

04

Gift cards and store credit

You can issue a gift card, redeem it against an order it cannot fully cover, and show a remaining balance that agrees with its history.

05

An order that moves through states

You can move an order through its states, refuse a transition that should not happen, and show the history of how it got where it is.

06

Background jobs

You can hand work to a worker, tell the user it is in progress, and show the result when it lands — and say what happens to that work if the process dies halfway.

07

Statements that reconcile

You can generate a statement for a date range that adds up, downloads, and returns the same figures when it is generated again next month.

08

Going live

Somebody who has never met you can open a URL and use the product — and you can say what is different about the copy running there, where its secrets come from, and what you do when a release turns out to be wrong.

The roadmap

8 sprints, 39 tasks

Every sprint has a goal and a set of tasks. Open a sprint to see the tasks you will pick up.

  1. Sprint 01

    The front door

    Somebody can create an account, come back to it, and sign out properly on a computer that is not theirs.

    4 tasks
    1. Let a customer create an account and be signed in straight away
    2. Keep a customer signed in after a reload and overnight
    3. Make signing out stop the credential working on the server
    4. Stop anyone creating a staff account from the sign-up form
  2. Sprint 02

    A shop and a till

    Somebody can fill a basket and place an order that records what was bought, what it cost, and that it was paid.

    5 tasks
    1. Let staff put things on sale at a price they can change
    2. Keep a customer's basket until they come back
    3. Total the basket at today's prices and show it before paying
    4. Take payment through the pretend payment step and record the order
    5. Show a customer the orders they have placed
  3. Sprint 03

    Money on a card

    A gift card can be bought, reaches the person it was for, and becomes a balance that is the sum of its movements.

    5 tasks
    1. Let a customer buy a gift card for somebody else
    2. Make a card's balance the sum of its movements
    3. Make gift card codes impossible to find by guessing
    4. Let the person a card was for claim it, only once
    5. Keep every amount exact, so a thousand movements add up to the penny
  4. Sprint 04

    Spending it

    A card pays for an order, or for part of one, and two checkouts can never spend the same money.

    5 tasks
    1. Let a customer pay for a whole order with a gift card
    2. Let the rest of an order be paid another way when the card is short
    3. Take card money only when the order is placed, and never if it fails
    4. Prove that two checkouts can never spend the same money
    5. Show in the wallet what was spent and what is left
  5. Sprint 05

    Money coming back

    A cancelled or refunded order gives the money back, as new movements, to the right place, exactly once.

    6 tasks
    1. Move orders through their stages, never backwards
    2. Let a customer cancel before dispatch and get the money back
    3. Let staff refund a sent order, with the gift card share as store credit
    4. Settle a cancel and a dispatch of the same order at the same moment
    5. Split a part refund between gift card and payment by a stated rule
    6. Let customers spend store credit at checkout, in a stated order
  6. Sprint 06

    Nothing vanishes quietly

    A balance expires on a schedule, after a warning in time to spend it, leaving a movement that says why.

    5 tasks
    1. Show every balance's expiry date and warn 30 days before it
    2. Expire a balance with a movement that says why
    3. Run warnings and expiries every night with nobody pressing anything
    4. Make a repeated or overlapping run change nothing the second time
    5. Let staff reinstate an expired balance or give goodwill credit
  7. Sprint 07

    Where the money went

    Anybody entitled to see a balance can see every movement on it, and they add up to the figure on the screen.

    5 tasks
    1. Show a statement of every movement that adds up to the balance
    2. Keep last month's statement exactly the same next month
    3. Let staff look up any balance's history to explain it on the phone
    4. Keep long statements fast and pages free of repeats or gaps
    5. Let a customer download their statement as a spreadsheet file
  8. Sprint 08

    Open for business

    The shop is on the internet at its own address, holding real balances, and the developer is not needed to keep it running.

    4 tasks
    1. Run the shop on a host at its own secure address
    2. Supply every secret and setting from outside the repository
    3. Make releases undoable and keep the money data safe through each one
    4. Show whether the shop is up and whether last night's run happened
The reading

Read before you build

Senior engineers read the docs before they touch the code. Every Blueprint comes with short documents on the product and its world, the kind a team hands a new hire. Read them well and you ask sharper questions and walk into every review prepared.

What you are building

The shop, the two kinds of people who use it, and what finished means when the product holds somebody's money.

A balance is not a number

Why the shop stores movements and adds them up, what that costs, and the three questions the obvious design cannot answer.

More commerce Blueprints

More to build

Not the one for you?

Every Blueprint is planned the same way, across health, shopping, money, education and more.

Browse all Blueprints
Ready?

Build gift cards and store credit.

Start your free week. Adaeze runs your kickoff, and Lars reviews every pull request.

Start today, for free