renewals: detect a subscription Mollie cancelled and revoke at once #83

Stängd
öppnade 2026-10-05 12:32:38 +00:00 av supernaut · 2 kommentarer
Ägare

Problem

A failed renewal only sets past_due (src/billing.ts:661-692). Access ends when the sweep runs after the 8-day grace (billing.ts:1320-1328). Nothing reads the Mollie subscription's own status or the mandate.

Mollie cancels a subscription at once for some failure reasons (for example "account closed"), and after 3 attempts for others. A customer whose subscription Mollie cancelled on day 1 keeps tier_pro for 8 days, and our subscription row says past_due while Mollie says canceled.

Mollie docs

  • "After all retries have been exhausted, the subscription will be cancelled." Some failure reasons cancel it immediately or after 3 attempts. Cancelling can also revoke a fixed mandate (https://docs.mollie.com/docs/recurring-payments).
  • Webhooks fire for payments, not for subscription status changes.

Fix

On a failed renewal, and for every past_due subscription in the sweep, call customerSubscriptions.get. When Mollie reports canceled (or suspended), end the subscription and revoke at once, with the same path the grace expiry uses.

Related: #53 (dunning reminder) and #85 (card replacement). This issue is detection only.

Done when

  • A unit test with a provider fake returning canceled proves the sweep ends the subscription before the grace runs out.
  • Staging: a renewal set to failed, then a Mollie-side cancel, revokes on the next sweep.

Found in the Mollie docs audit of 2026-10-05.

## Problem A failed renewal only sets `past_due` (`src/billing.ts:661-692`). Access ends when the sweep runs after the 8-day grace (`billing.ts:1320-1328`). Nothing reads the Mollie subscription's own status or the mandate. Mollie cancels a subscription at once for some failure reasons (for example "account closed"), and after 3 attempts for others. A customer whose subscription Mollie cancelled on day 1 keeps `tier_pro` for 8 days, and our `subscription` row says `past_due` while Mollie says `canceled`. ## Mollie docs - "After all retries have been exhausted, the subscription will be cancelled." Some failure reasons cancel it immediately or after 3 attempts. Cancelling can also revoke a fixed mandate (https://docs.mollie.com/docs/recurring-payments). - Webhooks fire for payments, not for subscription status changes. ## Fix On a failed renewal, and for every `past_due` subscription in the sweep, call `customerSubscriptions.get`. When Mollie reports `canceled` (or `suspended`), end the subscription and revoke at once, with the same path the grace expiry uses. Related: #53 (dunning reminder) and #85 (card replacement). This issue is detection only. ## Done when - A unit test with a provider fake returning `canceled` proves the sweep ends the subscription before the grace runs out. - Staging: a renewal set to failed, then a Mollie-side cancel, revokes on the next sweep. Found in the Mollie docs audit of 2026-10-05.
supernaut lade till detta till projektet Bitborg Payment 2026-10-05 12:34:43 +00:00
Upphovsperson
Ägare

#157 only sets past_due when Mollie reports a subscription canceled or suspended, and keeps the 8-day grace. This issue still asks for access to end at once when Mollie stops a subscription. Decision needed: whether a Mollie-side stop should skip the grace.

#157 only sets `past_due` when Mollie reports a subscription `canceled` or `suspended`, and keeps the 8-day grace. This issue still asks for access to end at once when Mollie stops a subscription. Decision needed: whether a Mollie-side stop should skip the grace.
Upphovsperson
Ägare

Decision: keep the grace. A subscription Mollie cancels or suspends goes past_due (#157) and keeps the normal 8-day grace. The customer can buy again during the grace and the new period continues from the old period end (#156, shipped in #176). Nothing left to build here.

Decision: keep the grace. A subscription Mollie cancels or suspends goes `past_due` (#157) and keeps the normal 8-day grace. The customer can buy again during the grace and the new period continues from the old period end (#156, shipped in #176). Nothing left to build here.
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#83
Ingen beskrivning angiven.