Inspiration

Every buy-now-pay-later checkout asks the same two questions: how much, and what country are you in. Neither of them is "can you carry this".

That gap is not a secret. LendingTree found 47% of BNPL users paid late at least once in the past year, up from 34% two years earlier. The CFPB found 63% of BNPL users carrying several loans at once. And BNPL complaints in the CFPB database went from 7,412 in all of 2025 to 10,884 by November 2026 — with two months of the year still to run.

None of that says the product is bad. It says the decision is being made without information the checkout already has. It knows the amount, the merchant, the device, the time of day. It just doesn't know that rent comes out on the 28th.

Before writing code we scanned 549 public repos in this hackathon's field to see how many people were answering that question. Under a "credit / BNPL" cluster we found three.

What it does

Second Thought sits at the moment of the split and answers one question: is this good for this person, this week? It projects the shopper's next 45 days — paydays against the bills they already have — and returns one of three answers.

 shopper's month ──┐
                   ├──▶  45-day cash-flow projection  ──▶  the floor test  ──┬──▶ OFFER
 this purchase ────┘                                   (never below a       │    pay in four
                                                        safety floor)       ├──▶ DEFER
                                                                            │    invoice on payday,
                                                                            │    ship on payment
                                                                            └──▶ DECLINE
                                                                                 name it, quote a
                                                                                 smaller number

The floor is max(10% of monthly income, $50). Not a credit score. Not a spending limit. Just: don't let this week break you.

Shopper Their month The answer What actually happens
Ada comfortable OFFER PayPal AUTHORIZE hold, funds reserved, valid 3 days
Ben a car payment lands before payday DEFER An invoice dated to his payday, and the merchant ships only after it clears
Cleo genuinely squeezed DECLINE Nothing offered. The collision is named, and the largest amount that would work is quoted

The three screens, verbatim from the build:

Pay on Sat 15 Nov — and it ships once you've paid Taking $249.00 today would leave you short before your next payday. Nothing is charged now, the price is held, and it goes out the door after your payment clears.

This one doesn't fit right now Paying $249.00 today leaves you short — because the 4th payment on a plan you already have lands around Sun 22 Dec. Up to $140.00 would work today.

That second one is the product. A checkout that only ever says yes is an advertisement.

DEFER is the part worth arguing about. The merchant extends no credit and waits on no receivable — PayPal pays, the shopper never borrows, and the goods ship when the money arrives. Compare that with a card decline, where a good customer is simply lost. Here the sale moves to a date the shopper can actually meet. That is the trade, and it is the whole idea: volume is not preserved, timing is.

How we built it

Four layers, no third-party dependencies, Python standard library only. Every file under 300 lines, because a judge has ten minutes and we would rather they could read it.

secondthought/
├── domain/      the verdict rules and the cash-flow projection — pure, deterministic, no I/O
├── app/         checkout orchestration, the reservation lifecycle, approvals, ports
├── ai/          the model reader, the template fallback, the agent that fuses them
├── infra/       PayPal adapter, simulated gateway, SQLite, RSA, webhooks
└── interfaces/  the HTTP layer, sessions, badges, and the one page a shopper sees

PayPal side. Server-side OAuth 2 client credentials, then Orders v2 (AUTHORIZE, capture, void) for OFFER, and Invoicing v2 for DEFER — the invoice's payment_term.due_date is computed by the same payday arithmetic that produced the verdict, not typed in. Webhook signatures are verified with RSA-SHA256 PKCS#1 v1.5 implemented against the standard library, over the raw request bytes. Every order and invoice carries a PayPal-Request-Id so a retry is never a second charge.

AI side. An OpenAI-compatible chat endpoint reads free text — "salary's 2,400 on the 15th, rent's 1,375 on the 1st, car loan 312 every second friday" — into dated amounts, at temperature: 0, JSON mode on. The design rule is a hard boundary:

The model supplies facts. The engine supplies the verdict. There is no code path from a model output to a decision. Agent.profile_from raises rather than pass a low-grade extraction into the engine.

Anything the reader can't resolve is flagged, not guessed — an inferred date gets a confidence cap and a question back to the shopper. Nonsense input degrades the answer to partial or demo; it never crashes and never invents a judgement.

Safety. Money moves only through a single-use HMAC approval token bound to the exact tool and arguments, so an edited amount or a replayed token is refused before any gateway call. Sessions live in memory, one per visitor, each with its own signing key. Rate limits are two-key (per session, per IP) and there is a call budget on the model. And the product tells the truth about itself: the badge reads AI · LLM-MOCK and PAYMENTS · SIMULATED until real credentials are loaded, because a demo that hides which mode it is in is the failure this design exists to prevent.

165 tests, 0.7 seconds, no network. They include the things we would want a judge to try to break: you cannot ship before payment, nothing moves without a human approval, an approval cannot be replayed or re-pointed, a retried webhook is harmless, and one visitor cannot spend another visitor's budget.

Challenges we ran into

The sandbox can't give you a real Pay Later plan. Eligibility is decided client-side from the amount and the buyer's country, which means you cannot reliably originate a genuine four-instalment plan as a merchant. So we stopped trying to stage one and moved the mechanic onto primitives we control end to end: an AUTHORIZE hold for today, an Invoicing invoice dated to a payday for later. That turned out to be the better architecture anyway — "pay before ship" is a stronger promise than "borrow from us".

The demo broke by itself, and that was the best bug. Our three demo months were pinned to November 2026 dates. Nothing in the code changed, but the calendar moved: Ben's payday passed, the reservation refused a date in the past, and the DEFER path — the hero of the pitch — started returning HTTP 500. Judging runs 1–15 December, when every one of those dates would be stale. The months are now generated relative to today, and a test walks sixty days forward asserting all three verdicts still appear. There is also a lint that fails the build if a literal date ever comes back into the demo path.

Money, twice. Dollars versus minor units is a hundred-fold error waiting to happen, so every amount in the system is an integer of cents and there is exactly one place that converts. Payday arithmetic was the other one: a fortnightly cadence with no anchor date must not borrow today's date at high confidence, so it caps the confidence and asks.

Webhook verification with no dependencies. The signed string is transmissionId|transmissionTime|webhookId|crc32(rawBody) over the raw bytes, and getting any part of that wrong fails closed with no useful error. Ours fails closed too, and says which of the four parts was missing.

Accomplishments that we're proud of

The promise is enforced in code, not in a paragraph. fulfil() raises unless the reservation is PAID. There is no method that lets a caller skip the payment state, so a merchant integrating this cannot accidentally ship into unpaid credit.

The refusal has a number in it. "Up to $140.00 would work today" is warmer and more useful than "declined", and it is the line that took the longest to get right.

A model that is not allowed to decide anything. Reading a messy month correctly and then having no vote in the outcome is the least fashionable use of an LLM here, and the reason we trust the thing at all.

A demo that will still work in December — including on a laptop with no network, since the page carries no external assets.

And one thing we are not proud of, but will say: we have not put this in front of real BNPL users yet. This was researched, built, and tested by us — 165 tests, and a stranger-free demo. The conversations are scheduled, not done. We would rather write that here than have someone find it out later.

What we learned

The payment is not the decision. By the time money moves, the interesting judgement has already happened. Most of the engineering here went into the second before the first request.

Deterministic money, fluent language. An LLM is excellent at turning a human sentence into structured facts, and a bad instrument for deciding whether someone can afford something. Keeping those two jobs apart made both easier.

Fake transports beat mocks. Our simulated PayPal gateway implements the same protocol as the live adapter, same shapes, same failure modes. Every bug it caught offline was a bug that would otherwise have surfaced in front of a judge.

Nobody reads status codes. The first version of the screen said DEFER. A person reading it does not know what that means. "Pay on Sat 15 Nov, and it ships once you've paid" is the same fact, and it is a product.

What's next for Second Thought

Real users, this month. Five conversations with people who actually use BNPL, written up as they happen rather than afterwards. If the answer is that the refusal reads as a lecture, we want to hear it from them and not from a judge.

A merchant view. The engine already knows what was deferred and what came back. A merchant wants one number: how much of my month moved instead of dying.

Close the loop on the real plan. Once we can originate a genuine Pay Later plan in sandbox, OFFER becomes a native PayPal plan rather than an authorisation hold, and the verdict drives PayPal's own instalment product.

Twelve weeks of dates. A payday model that has never seen a holiday-shifted payday is half a model. This one is honest about that: when it doesn't know, it says so and asks.

Built With

Share this project:

Updates

Submission history