Domdhi logoDOMDHI.OS
BACK_TO_COURSE

Walk It: Three Cases

Case 3: A Technical Integration

Ask

You run a class signup page. When somebody pays, they should land on the roster automatically. You don't write code.

When someone pays through Stripe, add them to my class roster.
I don't write code. What do professionals do for this, and what
goes wrong in the real world that a demo doesn't show?

The map: Stripe sends your site a message called a webhook every time something happens. Your code receives it and adds the person.

Dig

You won't be reading the code. So ask what you can judge: how does this fail?

  • Anyone can send your address a fake "they paid" message. So Stripe signs each one, and you check the signature.
  • Stripe may send the same message twice.
  • Messages can arrive out of order.
  • If your site is down, Stripe keeps retrying, for up to three days in live mode.

None of that shows up in a demo. In a demo one person pays once and it works.

Check

The AI builds it, says it's secure, and shows one successful payment. Don't take it. Ask for proof it can fail correctly:

Send it It should
A real signed message Add the person
The same message with the amount changed Refuse
A message signed with the wrong key Refuse
A real message, resent too long after it was signed (Stripe's own libraries default to 5 minutes) Refuse
The same real message, twice Add them once
Write a test for each row. Run them and show me the actual output.
Then break the signature check on purpose and show me the tests
fail. If they still pass, the tests are worthless.

That last part is the best trick in this course. A test that can't fail tells you nothing.

The Bug That Looks Like Nothing

Here's one that bites people. The signature covers the exact bytes Stripe sent. Plenty of code reads the message, then rewrites it before checking:

const raw = '{"id": "evt_1", "amount": 10.00}';
JSON.stringify(JSON.parse(raw));
// '{"id":"evt_1","amount":10}'

Same meaning, different characters, so a real payment gets refused. Now watch how the AI fixes it. The right fix is to check the original. The bluff fix is to loosen or skip the check so the error goes away. It'll say "fixed!" either way. Your five tests know the difference.

INFO

Letting AI change real files? Learn the undo button first. Git 101 covers it.

QUIZ

The AI says the signature check is done and every test passes. What's the strongest next move?

Sign in to track lesson progress and earn a certificate.SIGN IN TO SAVE PROGRESS