HomeChallengesRepsProblemsLeaderboardTake a challenge

Verifying What The Browser Claims

An endpoint that marks an order paid because the browser said so.

Intermediate25 min on the clock6 graded checks · 100 pointsASP.NET Core RefactorPro
Graded by reading your code against the checklist below.

What you build

  • Call Paystack to verify the reference with your secret key
  • Require the transaction status to be success
  • Compare the amount paid against the amount owed, in kobo
  • Compare the currency
  • Check the reference is the one stored on this order
  • Make the transition idempotent, because the webhook is coming too

Done means

The endpoint believes only Paystack, checks amount, currency and ownership, and fulfils once.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. It verifies the reference with Paystack+20Authentication and tokens
  2. The amount paid is compared to the amount owed+25Authentication and tokens
  3. The reference belongs to this order+15Authentication and tokens
  4. Only a successful transaction is accepted+10Failing in a shape callers can read
  5. The currency is compared+10Authentication and tokens
  6. A second confirmation fulfils nothing+20Safe to repeat

What it teaches

Safe to repeatintermediate

A request that times out has not necessarily failed — you just did not hear back — so the client retries, and unless the write recognises that it has already happened the customer is charged twice.

The rest of ASP.NET Core Refactor