Writing

Two implementations of one format, and the check that caught them disagreeing

1 November 2026

A merchant can now put a payment button on their own checkout. The request is built in their customer’s browser and carried in the link, which is the whole point — nothing about it reaches this site.

That creates a problem with no clean answer. A script running on somebody else’s domain cannot import a module from ours, so the encoder for the request format exists twice: once in TypeScript here, once in plain JavaScript there.

Duplication that fails silently

Two implementations of one wire format drift. Not loudly — a label encoded differently, a field dropped on one side, and the merchant’s button produces links that decode to a different amount or do not decode at all. The merchant would not find out. Their customer would.

So both are run over the same inputs and the strings compared, character for character, including a label with an em dash and an accent in it. The script extracts the embed from the route handler’s own template rather than from a copy, so the thing under test is the thing that is served.

It failed immediately, on something invisible

First run, three failures. The embed dropped trailing empty fields; the module does not. Every request without a label encoded differently:

embed   ...Ikludm9pY2UgNDQ3MSJd.q3hl module  ...Ikludm9pY2UgNDQ3MSIsMCwwXQ.qgeh

Here is why nothing else would have found it. The reader accepts a short array, soboth links open and both decode to the right request. The only symptom is two different strings for one payment, and a checksum that disagrees if anybody ever compares them. No error, no broken page, no complaint.

The trade

Duplication is usually worth avoiding and sometimes is not available. What is always available is making the duplication testable: the two copies are now an invariant rather than a hope, which is the same bargain made for the provider registries, the sitemap and the page dates.

Plan an exchange

Every figure above can be checked against the providers yourself — no account, no sign-up, and nothing is held for you at any point.