Skip to content

fix(core): show a Stripe subscription with paused collection as paused - #137

Merged
cavewebs merged 1 commit into
emdashCommerce:mainfrom
FIKANOVA:fix/stripe-subscription-paused
Dec 3, 2026
Merged

cavewebs merged 1 commit into
emdashCommerce:mainfrom
FIKANOVA:fix/stripe-subscription-paused

Conversation

@moset15

@moset15 moset15 commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Bug

The admin's Pause sets pause_collection at Stripe, but Stripe keeps the subscription's status active. upsertFromStripe stores Stripe's status as it is, so the row stays Active after the customer.subscription.updated webhook, and Resume, which the admin offers only for paused rows, never appears. Found while testing a shop end to end: once paused, a subscription couldn't be resumed from the admin.

Fix

An active or trialing subscription with pause_collection set is stored as paused. When collection resumes, Stripe clears pause_collection and the row goes back to Stripe's status. Other statuses (past_due, unpaid, canceled, …) are kept as Stripe sends them, so a payment problem isn't hidden behind "paused".

Tests

New packages/core/test/stripe-subscription-paused.test.ts, 4 tests, each through the real webhook route with a signed customer.subscription.updated:

  • active with pause_collection is stored as paused;
  • the same during a trial;
  • after a pause, an event with pause_collection: null sets it back to active;
  • past_due with pause_collection stays past_due.

3 fail without the fix; the past_due test passes both ways, as intended. Full suite: core 364 pass (plus the 4 local routing-response-adapter failures noted in the other PRs), paystack 105, lite 144. Core typecheck and Biome lint clean.

Compatibility

Only rows for paused Stripe subscriptions change. paused is already a SubscriptionStatus and the admin already offers Resume for it.

Review points

  • Stripe's own paused status (a trial that ended with no payment method) is unchanged and still comes through as paused.
  • The admin list updates when the webhook arrives, not the instant Pause is clicked. Making it instant means storing Stripe's reply in lifecycle.ts, which feat(flutterwave): Flutterwave payment provider package #107 is changing, so it's left for later.

Works on a real store once #127 merges: until customers.stripeCustomerId is indexed, customer.subscription.* webhooks fail before they reach this code. The code doesn't depend on #127 and merges on its own.

The admin's Pause sets `pause_collection` at Stripe, but Stripe keeps
the subscription's status `active`. `upsertFromStripe` stored Stripe's
status as it was, so the row stayed Active and Resume (offered only for
paused rows) never appeared.

An active or trialing subscription with `pause_collection` set is now
stored as `paused`. Once collection resumes Stripe clears the field and
the row goes back to its Stripe status. Other statuses, such as
`past_due`, are kept so a payment problem isn't hidden.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cavewebs
cavewebs merged commit 8216bc9 into emdashCommerce:main Dec 3, 2026
11 checks passed
@moset15
moset15 deleted the fix/stripe-subscription-paused branch December 6, 2026 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants