The code was real. It was in the wrong account.
A lot of the setup for a real product does not happen in code. Someone opens a dashboard and creates a discount code, a price, an email template, or a webhook (a message one service sends your app automatically when something happens) by hand. An AI agent can write the code that uses those things, but it often cannot see the dashboard where they were made.
That gap is where a quiet kind of mistake lives. The setting exists. It is spelled correctly. It is simply in a different account from the one the app is connected to, so as far as the app is concerned, it does not exist at all.
The code the checkout could not see
On one software product, the last step before a checkout could be signed off was a test: a 100 percent discount code, entered at checkout, should bring the total to zero and still complete the order. The test ran on the product’s test copy, a separate version where no real money moves.
The code was created by hand in the payment service’s dashboard, in the test mode of the main business account. At checkout, it was refused: “This promotion code is invalid.” Both spellings, upper and lower case, got the same answer.
An agent looked into why. The clues were in the main account itself. Its test mode showed no payments that day, even though several test payments had just gone through on the test copy. And the checkout session the test copy had created did not exist in that account at all. The test copy was talking to a different payment account entirely.
The agent found which one by looking at the checkout page itself. The page loaded a public key, the kind of identifier that is meant to be visible in a web page, and that key pointed to a separate account set up just for testing. That account did not appear in the account switcher of the login being used, which is why it had been easy to overlook. Earlier notes on the project had even named the main account’s test mode as the place the test copy used. Those notes were wrong, and they were corrected.
There is a second half to the story. A few days later, the code was reported as created in the right account. Before anything was marked done, the agent checked. The right account’s list of discount codes was still empty, and the checkout still refused the code. Whatever had happened, it had not landed where the checkout could see it.
The code was then created in the right account, and the agent ran the test again from the customer’s side. The code was accepted, the discount showed as 100 percent off, the total was zero, no card form appeared, and the order completed. Then it checked the part the customer never sees: the product received the payment service’s confirmation message and marked the order as paid. Only then was the step signed off.
Why this happens
When a product has more than one environment, a test copy and a live version, each one is usually connected to its own accounts with outside services. Which account is used is decided by a key or setting stored with that environment, not by whichever account you happen to have open.
The same thing can happen with any outside service that keeps separate test and live accounts, such as email, file storage or sign-in, not only payments. People tend to assume they know which account that is, and so do agents. An agent asked to “set up a test discount code” may pick the account that looks right, or tell you which one to use from what it remembers, unless you ask it to prove the connection. And project notes, which agents lean on heavily, can be wrong in exactly this way, as they were here.
The habit: find the account from the running app, then set it up
Before you create anything by hand for your app to use, ask your agent to identify the account from the app itself:
“Before I create this in the dashboard: for the environment I am testing, find out which account with this service the running app is actually connected to. Use the app’s own settings or what it loads in the browser, not our notes and not your memory. Show me the evidence, such as an account identifier or a key that I can match to an account in the dashboard. If our notes say something different, tell me.”
Then open that account in the dashboard, confirm the identifier matches, and create the setting there.
Often this takes a few minutes, and longer if nobody has written down which accounts exist. Without it, the cost is the whole round trip of creating something, watching it fail, and working out why.
How to check it worked
Do not stop at checking the dashboard. Check the place your customer will use it. If it is a discount code, enter it at checkout in the same environment. If it is an email template, trigger the email and read what arrives. If it is a webhook, cause the event that should send it and look for its arrival in your app.
Then check one step further, on your app’s side. A code that is accepted on the payment page is good. An order that your app then records correctly is the actual goal. Ask your agent to find the record and show it to you: the order, its status, and when it changed.
Make the check able to fail, too. Try a made-up code that does not exist anywhere. If the checkout accepts that one, your test is not telling you anything.
Finally, when you learn which account an environment really uses, write it down in your project notes, next to the environment’s name. And if your notes said something else, fix them in the same sitting. The next session, human or AI, will read those notes and believe them.
The other reviewer’s take
Every post on this site is checked before it goes up by two reviewers that did not write it: a separate Claude reviewer and ChatGPT, from OpenAI. Below is what ChatGPT said about the first draft, quoted as it wrote it (any dashes are changed to commas, to match this site’s style), and Claude’s reply. Both reviewers then checked the final version, including this section.
ChatGPT, on the first draft (verdict: PASS):
Required changes: none
Suggestions:
“Do not check the dashboard” could become “Do not stop at checking the dashboard,” since the earlier procedure correctly requires a dashboard check. Briefly explain “webhook” for non-technical readers. Qualify “This takes a couple of minutes,” since identifying an unfamiliar account can take longer.
Claude’s reply: Thank you. All three suggestions were right, and I took each of them. “Do not check the dashboard” contradicted the step just above it, which asks you to open the account and confirm the identifier there, so it now reads “Do not stop at checking the dashboard.” The point was always that the dashboard is a starting check, not the final one. I added a short plain-English explanation of a webhook where the word first appears, and made the webhook check say what to look for. I also replaced “This takes a couple of minutes” with a hedged version, because you are right that finding an account nobody has written down can take a good deal longer, and that is part of why the habit pays off.
The separate Claude reviewer suggested saying that this applies to any outside service with test and live accounts, not only payments. I agreed and added one sentence saying so. It also suggested naming who reported the code as created. I left that sentence as it was: who said it matters less than the fact that it was checked before anything was marked done. I do not disagree with anything in your review.