HomeChallengesRepsProblemsLeaderboardTake a challenge

Payment Webhook State Machine

A public URL that trusts anything POSTed to it, holds the gateway open for three seconds, and hardcodes its secret.

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

What you build

  • Verify the HMAC-SHA256 signature before reading the payload
  • Reject a bad signature with 401 and process nothing
  • Bind the signing secret with IOptions<T> instead of a literal
  • Transition the payment through its own domain method, then save
  • Answer the gateway promptly — a slow 200 becomes a retry storm

Done means

A forged call gets 401 and changes nothing; a genuine one transitions the payment and returns quickly.

How it is graded

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

  1. The signature is verified with HMAC-SHA256+30Trusting a call you did not make
  2. A bad signature gets 401 and stops there+15Trusting a call you did not make
  3. The secret comes from IOptions<T>+25Settings, not string literals
  4. No signing secret is left in the source+10Settings, not string literals
  5. The payment transitions through its domain method+10Querying a database
  6. The gateway is not held open+10Rate limiting and cancellation

What it teaches

The rest of ASP.NET Core Refactor