Discourse Subscriptions - account deleted too soon when user cancels - deletion not noted on admin interface

Steps taken: I created a test user and set up a one-day recurring subscription, then cancelled it (as the user) last night at about 2330 (it’s 2030 now here). When I had a look tonight I saw:

  1. Stripe website - subscription listed as active with note “Scheduled to cancel on 23 Nov, 23:34”.
  2. Discourse admin interface - subscription listed as active.
  3. Discourse user interface - the user interface says “You have no active subscriptions.” and the user has been removed from Discourse’s subscription group.

What seems wrong: It’s 3 that surprised me – it’s inconsistent with the admin interface, and seems wrong. I had expected the subscription to be listed as active (but “Renews: Cancelled”) and the user to remain in the group.

Some guesswork: There is nothing relevant in Stripe’s webhook log. Is it maybe that Discourse deletes the subscription in the user interface (and removes the user from group) at the beginning of the relevant day (23 Nov) instead of waiting and only doing it when processing the webhook? I bet when it tries to process the webhook at 2334 it’ll return a customer not found error.

The guess was right, I think. Two identical customer.subscription.deleted at 23:35:50 and 23:36:05 with error customer not found.

The subscription has now disappeared from the Discourse admin page and has been cancelled on the Stripe website.