Behind the scenes: two shops, one postage engine, and a 502 nobody could see
Real postage for two small shops, an order pipeline waiting on one last switch, and a Stripe error that Cloudflare replaced with its own page.
There are two small online shops in my week now. Annapolis Tools sells the woodworking layout and drilling tools I design and make for my own bench. Lily Bus is Elizabeth Ross's shop, a family workshop in Fort Erie selling vintage clothing, crafts and 3D-printed Christmas trees, and I look after the plumbing. This week was the unglamorous part of both: taking an order, keeping a record of it, and charging the right postage.
The week in short:
- One shipping engine now prices real postage for both shops, instead of two shops each guessing.
- Paid orders have somewhere to land, a database row and an email to me, once I flip one last switch in Stripe's dashboard.
- A checkout test runs every six hours, so a broken shop tells me before it tells a customer.
- Lily Bus got a newsletter signup, a rebuilt homepage, and a script that checks its own asset links.
- One Stripe error never reached me, because Cloudflare had swapped in its own page.
Postage, from published rates and real quotes
Until Wednesday, the shops charged shipping from a table I had typed in with more confidence than evidence. The replacement is a single file that both sites share. Flat items going to a Canadian address ride Canada Post Lettermail, boxes use quotes I pulled from the Chit Chats API, and anything headed to the United States leaves from a Buffalo ZIP code on USPS Ground Advantage, using USPS's own zone chart for that origin. The prices are plain data at the top of the file, so a rate change is a one-line edit.
The file's header names the exact carrier documents and effective dates the numbers came from, which is a habit I recommend and also a confession: I trust my own memory of a postage rate about as far as I trust my memory of a phone number.
Stripe was the only record of an order
Both shops use Stripe Checkout, and until this week Stripe was the only place an order existed. If a customer paid, I would find out by looking. Now a webhook re-fetches each paid session from Stripe and writes a row to a database, and a small script on my home machine emails me the order. Annapolis Tools orders that include the optional donation to The Ass Menagerie Sanctuary get flagged, because that money is not mine and I would like to pass it on without having to remember.
The code is done. Stripe still has to be told where to send the orders, and that part is a form in a dashboard that only I can fill in, so the whole pipeline is currently waiting on me.
The checkout check is the part I like best. Every six hours a script asks each shop for a real Stripe checkout page, stops short of paying, and emails me if either shop cannot produce one. I added it because a wrong key had once broken Lily Bus checkout, and nothing had noticed.
Why the 502 never reached me
When Stripe failed during a test, my function returned a 502, and the browser showed a plain Cloudflare error page instead of whatever Stripe had actually said. A function that answers 502 gets its response swapped for the platform's own, so the real reason went nowhere. Returning a 500 fixed it. Unlike last week's 403, this one really was Cloudflare's doing, though it was only following the rules.
Two smaller surprises sat next to it. Stripe's abandoned-cart recovery is not available on my Canadian account, which I learned by asking Stripe for it and being told no. And Annapolis Tools had its cart script cached at the edge long enough that my fixes looked like they had not shipped, so the script's filename now carries a version number I bump by hand.
A newsletter signup and a rebuilt Lily Bus homepage
Lily Bus picked up a newsletter signup this week, which needed four separate things to agree before a single address would save. Today I rebuilt its homepage and error page from the same shared shell as the other pages, retired some stale CSS, and wrote a short script that checks every asset link on the site. The homepage now mentions Fort Erie, which for a shop that ships from Fort Erie seemed overdue.
The order email that has not arrived yet
Most of the week went on things nobody will see. The storefronts look the same as they did on Monday, and the only visible change is that I have stopped planning to check Stripe by hand. The email I am waiting for is the first real order notification, which will mean the last switch got flipped.
I built and run both sites. Annapolis Tools is mine, Lily Bus is family, and neither is client work. If your own orders live only in your payment processor, ask. Last week's installment, a 403 that wasn't Cloudflare, covers the other half of my error-page grudge.