Experiments >

IdP: Closing accounts

Experiment #22512th June, 2022by Joshua Nussbaum

In the last experiment, I integrated the Stripe billing portal and realized it can handle the subscription canceling flow and result in closing the account in the IdP.

So all that’s left to do:

  • Handle the customer.subscription.deleted webhook.
  • Update the account paymentStatus, cancelAt, canceledAt, and closedAt. Here’s an explanation of the fields:
    • cancelAt is the timestamp the subscription is expected to cancel.
    • canceledAt is the timestamp when the cancelation request was submitted.
    • closedAt is the timestamp when the subscription stopped being active. Only set once the subscription is over.
  • Revoke tokens for all account members.
  • Block signin for members of closed accounts.

Code

joshnuss/idp-experiment@fe9fa92

Notes

  • Unfourtunately the canelation_reason is not availabe via Stripe’s API, but it is available with Stripe Sigma
  • Need to send webhooks when account is closed or token revoked.
  • Get a better understanding of the expired token, how is the access token effected? Will it keep work for 15 minutes?
view all experiments

Stay tuned in

Learn how to add more experimentation to your workflow