fix(billing): report a failed checkout for a returning customer #143

Stängd
öppnade 2026-10-12 13:15:00 +00:00 av supernaut · 0 kommentarer
Ägare

latestSubscription (src/billing.ts:271-292) skips only incomplete rows. subscriptionStatus (:426-449) reports a failed first payment only when no other subscription exists.

Failing case:

  1. A customer's earlier subscription is canceled (ended, withdrawn or refused).
  2. They check out again and the card fails, or the payment expires.
  3. subscriptionStatus returns the old subscription. The return page drops its old charge and polls to the neutral "unknown" text. It never shows the failure or the retry button.

Mollie calls failed and expired definitive (https://docs.mollie.com/docs/handling-payment-status). We receive them but hide them.

Fix: take the newest subscription of any status first. Report it when it is incomplete with a failed, canceled or expired latest charge. Otherwise fall back to latestSubscription. Add a test with an old canceled subscription and a new failed one.

`latestSubscription` (`src/billing.ts:271-292`) skips only `incomplete` rows. `subscriptionStatus` (`:426-449`) reports a failed first payment only when no other subscription exists. Failing case: 1. A customer's earlier subscription is `canceled` (ended, withdrawn or refused). 2. They check out again and the card fails, or the payment expires. 3. `subscriptionStatus` returns the old subscription. The return page drops its old charge and polls to the neutral "unknown" text. It never shows the failure or the retry button. Mollie calls `failed` and `expired` definitive (https://docs.mollie.com/docs/handling-payment-status). We receive them but hide them. Fix: take the newest subscription of any status first. Report it when it is `incomplete` with a failed, canceled or expired latest charge. Otherwise fall back to `latestSubscription`. Add a test with an old canceled subscription and a new failed one.
supernaut lade till detta till projektet Bitborg Payment 2026-10-12 13:16:12 +00:00
Logga in för att delta i denna konversation.
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-payment#143
Ingen beskrivning angiven.